:root {
    --primary: #173553;
    --primary-hover: #10263d;
    --primary-rgb: 23, 53, 83;
    --button-primary: #315d87;
    --button-primary-hover: #264b70;
    --button-primary-rgb: 49, 93, 135;
    --primary-light: #e8f1fa;
    --primary-light-rgb: 232, 241, 250;
    --primary-highlight: #79b6f4;
    --primary-highlight-rgb: 121, 182, 244;
    --primary-hover-soft-rgb: 93, 159, 231;
    --primary-muted: #a9bfd4;
    --accent: #c3973b;
    --accent-strong: #8f6b22;
    --accent-rgb: 195, 151, 59;
    --danger-soft: rgba(255, 227, 219, 1);
    --expired-soft: #f2e6e5;
    --expired-border: #e5cdcb;
    --expired-accent: #b87570;
    --expired-strong: #985a55;

    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-soft: #fafbfc;
    --text: #183153;
    --text-soft: #5f7187;
    --border: #e0e5ec;
    --success-soft: #e8f6ee;
    --stock-ok-soft: #e4eee6;
    --warning-soft: #fff4d9;

    --shadow: 0 10px 28px rgba(24, 49, 83, 0.06);
    --shadow-soft: 0 4px 14px rgba(24, 49, 83, 0.05);

    --radius: 16px;
    --radius-lg: 22px;
    --pill: 999px;
}

/* Reset & base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(var(--primary-light-rgb), 0.35), transparent 25%),
        linear-gradient(180deg, #fbfcfd 0%, var(--bg) 100%);
    color: var(--text);
}

a {
    color: var(--primary);
}

.wrap {
    max-width: 1500px;
    margin: 40px auto 56px;
    padding: 0 clamp(16px, 2.2vw, 36px);
}

.wrap > h2 {
    margin: 34px 0 12px;
    padding: 0 4px;
    color: var(--text-soft);
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.wrap-log .formular {
    max-width: 460px;
}

/* Typography */
h1 {
    margin: 0 0 8px;
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

h2 {
    margin: 28px 0 14px;
    padding: 4px;
    color: var(--primary);
    font-size: 20px;
    line-height: 1.2;
}

.header-info {
    min-width: 0;
}

.header-info h1 {
    margin: 0 0 10px;
}

.header-bar,
.form-page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
    padding: 24px 26px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), var(--surface-soft));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.header-bar p,
.form-page-head p {
    margin: 0;
    color: var(--text-soft);
}

.header-bar > div:last-child {
    min-width: 0;
}

.header-subline {
    font-size: 14px;
    line-height: 1.5;
}

.header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    justify-content: end;
    align-items: start;
}

.header-actions > * {
    min-width: 0;
}

.header-actions > a {
    width: 100%;
}

.header-actions a.aktion-link,
.header-actions button.aktion-button {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.2;
}

.header-actions a:nth-child(2) {
    font-weight: 700;
}

/* Unified pill button system */
.aktion-link,
.aktion-button,
.filter-grid button,
.mini-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border-radius: var(--pill);
    cursor: pointer;
    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        background 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease;
}

.aktion-link,
.aktion-button,
.filter-grid button {
    background: linear-gradient(180deg, var(--button-primary), var(--button-primary-hover));
    color: #fff;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    box-shadow: 0 8px 18px rgba(var(--button-primary-rgb), 0.2);
}

.aktion-link:hover,
.aktion-button:hover,
.filter-grid button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(var(--button-primary-rgb), 0.26);
}

.aktion-loeschen {
    background: #fff;
    color: #b42318;
    border: 1px solid #f0c2ba;
    box-shadow: none;
}

.aktion-loeschen:hover {
    background: var(--danger-soft);
    box-shadow: none;
}

.aktion-link-secondary,
.mini-link,
.quick-filter {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.aktion-link-secondary {
    font-size: 13px;
    font-weight: 600;
}

.aktion-link-secondary:hover,
.mini-link:hover,
.quick-filter:hover {
    background: rgba(var(--primary-hover-soft-rgb), 0.12);
    border-color: rgba(var(--primary-hover-soft-rgb), 0.42);
    box-shadow: none;
    transform: translateY(-1px);
}

.mini-link {
    font-size: 12px;
    line-height: 1;
    padding: 6px 10px;
}

.mini-link-loeschen {
    background: #fff;
}

.mini-link-loeschen:hover {
    background: var(--danger-soft);
    border-color: rgba(224, 133, 117, 0.4);
}

/* Gemeinsame Oberfläche für Filter, Kennzahlen, Hinweise und Produktkarten */
.filter-form,
.stat-card,
.warnbox,
.produkt {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

/* Filter */
.filter-form {
    background: rgba(255, 255, 255, 0.94);
    padding: 18px;
    margin-bottom: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    align-items: end;
}

.filter-grid label,
.formular label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
}

.filter-grid input,
.filter-grid select,
.formular input,
.formular select,
.formular button:not(.aktion-button):not(.mini-link) {
    width: 100%;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 15px;
    outline: none;
}

.filter-grid input:focus,
.filter-grid select:focus,
.formular input:focus,
.formular select:focus {
    border-color: rgba(var(--primary-rgb), 0.35);
    box-shadow: 0 0 0 4px rgba(var(--primary-light-rgb), 0.16);
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: nowrap;
}

.filter-actions .aktion-link,
.filter-actions button {
    flex: 1 1 0;
    text-align: center;
}

.filter-actions a.aktion-link {
    display: flex;
    justify-content: center;
    align-items: center;
}

.quick-filter-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 0 0 20px;
}

.quick-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* min-height: 38px; */
    padding: 8px 12px;
    border-radius: var(--pill);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.quick-filter.is-active {
    background: linear-gradient(180deg, var(--button-primary), var(--button-primary-hover));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(var(--button-primary-rgb), 0.2);
    transform: translateY(-1px);
}

.active-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: var(--pill);
    background: rgba(var(--primary-light-rgb), 0.14);
    border: 1px solid rgba(var(--primary-rgb), 0.16);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(180deg, #ffffff, #fafdff);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card-danger {
    background: linear-gradient(180deg, rgba(255, 227, 219, 0.72), rgba(255, 255, 255, 0.95));
}

.stat-card-accent {
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.14), rgba(255, 255, 255, 0.95));
}

.stat-card-limits {
    background: rgba(var(--primary-rgb), 0.08);
    border-color: rgba(var(--primary-rgb), 0.18);
}

.stat-card-link {
    color: inherit;
    text-decoration: none;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.stat-card-link:hover,
.stat-card-link:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(var(--accent-rgb), 0.48);
    box-shadow: var(--shadow);
    outline: 3px solid rgba(var(--primary-rgb), 0.28);
    outline-offset: 2px;
}

.stat-card-limits.stat-card-link:hover,
.stat-card-limits.stat-card-link:focus-visible {
    border-color: rgba(var(--primary-rgb), 0.38);
}

.stat-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 34px;
    line-height: 1;
    color: var(--primary);
    letter-spacing: -0.03em;
}

.stat-card-danger .stat-value {
    color: #b42318;
}

.stat-card-accent .stat-value {
    color: var(--accent-strong);
}

.stat-card-limits .stat-label,
.stat-card-limits .stat-value {
    color: var(--primary);
}

/* Global accordion actions */
.accordion-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Warn boxes */
.warnbox {
    padding: 18px;
    margin-bottom: 18px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.95);
    position: relative;
    overflow: hidden;
}

.warnbox::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    border-radius: var(--radius) 0 0 var(--radius);
    background: var(--border);
}

.warnbox-danger {
    background: linear-gradient(180deg, rgba(255, 227, 219, 0.82), rgba(255, 255, 255, 0.98));
    border-color: rgba(224, 133, 117, 0.45);
    box-shadow: 0 10px 24px rgba(180, 35, 24, 0.08);
}

.warnbox-danger::before {
    background: #d92d20;
}

.warnbox-abgelaufen {
    background: var(--expired-soft);
    border-color: var(--expired-border);
    box-shadow: 0 8px 18px rgba(95, 54, 52, 0.05);
}

.warnbox-abgelaufen::before {
    background: var(--expired-accent);
}

.warnbox-abgelaufen .warn-count {
    background: var(--expired-accent);
    color: #fff;
}

.warnbox-abgelaufen .warnbox-head h2 {
    color: var(--expired-strong);
}

.warnbox-accent {
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), rgba(255, 255, 255, 0.98));
    border-color: rgba(var(--accent-rgb), 0.34);
}

.warnbox-limits {
    background: rgba(var(--primary-rgb), 0.08);
    border-color: rgba(var(--primary-rgb), 0.18);
}

.warnbox-limits::before {
    background: var(--button-primary);
}

.warnbox-limits .warn-count {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.22);
}

.warnbox-limits .warnbox-head h2 {
    color: var(--primary);
}

.warnbox-accent::before {
    background: var(--accent);
}

.warnbox-forecast {
    background: rgba(var(--accent-rgb), 0.12);
    border-color: rgba(var(--accent-rgb), 0.24);
}

.warnbox-forecast::before {
    background: var(--accent);
}

.warnbox-danger .warn-count {
    background: #d92d20;
}

.warnbox-accent .warn-count {
    background: var(--accent);
    color: #fff;
}

.warnbox-forecast .warn-count {
    background: rgba(var(--accent-rgb), 0.18);
    color: var(--accent-strong);
    border: 1px solid rgba(var(--accent-rgb), 0.24);
}

.warnbox-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.warnbox-head h2 {
    margin: 0;
    font-size: 19px;
}

.warnbox-danger .warnbox-head h2 {
    color: #b42318;
}

.warnbox-accent .warnbox-head h2 {
    color: var(--accent-strong);
}

.warnbox-forecast .warnbox-head h2 {
    color: var(--primary);
}

.warn-count {
    min-width: 34px;
    height: 34px;
    padding: 0 11px;
    border-radius: var(--pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.warnliste {
    list-style: none;
    margin: 0;
    padding: 0;
}

.warnliste li {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 8px;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 12px;
}

.warnbox .warnliste strong {
    font-weight: 700;
}

.warnbox-danger .warnliste li {
    background: rgba(255, 255, 255, 0.48);
}

.warnbox-accent .warnliste li {
    background: rgba(255, 255, 255, 0.52);
}

.warnbox-forecast .warnliste li {
    background: rgba(255, 255, 255, 0.7);
}

.expiry-alert-grid .warnliste li.rot,
.expiry-alert-grid .warnliste li.gelb,
.warnbox-limits .warnliste li {
    background: var(--surface-soft);
}

.expiry-alert-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 16px;
    margin-bottom: 18px;
}

.expiry-alert-grid .warnbox {
    margin-bottom: 0;
}

/* Product cards */
.produkt {
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    padding: 18px 20px;
    margin: 0 0 16px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.produkt:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(24, 49, 83, 0.08);
    border-color: rgba(var(--primary-light-rgb), 0.55);
}

.produkt-hinweis {
    font-size: 12px;
    color: var(--text-soft);
}

.produkt-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 20px;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    list-style: none;
}

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

.produkt-summary::after {
    content: "▾";
    font-size: 17px;
    color: var(--primary);
    justify-self: end;
    transition: transform 0.16s ease;
}

details:not([open]) .produkt-summary::after {
    transform: rotate(-90deg);
}

.produkt-titel {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    min-width: 0;
    overflow-wrap: anywhere;
}

.produkt-meta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: var(--pill);
    background: rgba(var(--primary-light-rgb), 0.14);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.produkt-inhalt {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.produkt-kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 16px;
}

.produkt-aktionen {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.produkt-aktionen .aktion-link,
.produkt-aktionen .aktion-loeschen {
    min-width: 120px;
}

/* Charge list */
.chargen-liste {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chargen-liste li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 8px;
    transition: background 0.16s ease, box-shadow 0.16s ease;
}

.chargen-liste li.rot,
.chargen-liste li.gelb,
.chargen-liste li.gruen {
    background: var(--surface-soft);
}

.chargen-liste li:hover {
    box-shadow: inset 0 0 0 1px rgba(24, 49, 83, 0.05);
}

.charge-links {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.charge-menge {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
}

.charge-wert {
    font-weight: 800;
    font-size: 15px;
    color: var(--text);
}

.charge-einheit {
    white-space: nowrap;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
}

.charge-rechts {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.charge-datum {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(24, 49, 83, 0.06);
    font-weight: 700;
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
}

.charge-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: var(--pill);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.charge-status-expired {
    color: var(--expired-strong);
    background: var(--expired-soft);
    border-color: var(--expired-border);
}

.charge-status-soon {
    color: var(--accent-strong);
    background: rgba(var(--accent-rgb), 0.12);
    border-color: rgba(var(--accent-rgb), 0.24);
}

.charge-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.charge-minus-form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}

.charge-minus-btn {
    background: #fff;
    color: #b42318;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid #f0c2ba;
    box-shadow: 0 2px 6px rgba(180, 35, 24, 0.06);
    cursor: pointer;
}

.charge-minus-btn:hover {
    background: var(--danger-soft);
    border-color: rgba(224, 133, 117, 0.4);
}

.keine-chargen {
    margin: 0;
    color: var(--text-soft);
}

/* Status colors */
.rot {
    background: var(--expired-soft);
}

.gelb {
    background: rgba(var(--accent-rgb), 0.16);
}

.gruen {
    background: var(--stock-ok-soft);
}

/* Forms / auth / info cards */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-wrap {
    width: 100%;
    max-width: 460px;
}

.auth-card,
.form-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.auth-head {
    margin-bottom: 20px;
}

.auth-head h1 {
    margin: 0 0 8px;
}

.auth-head p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.5;
}

.auth-submit {
    width: 100%;
    min-height: 42px;
}

.formular {
    display: grid;
    gap: 16px;
}

.formular-zweispaltig {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    min-width: 0;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-divider {
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.form-divider h2 {
    margin: 0 0 6px;
    font-size: 18px;
}

.form-divider p {
    margin: 0;
    color: var(--text-soft);
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.form-button {
    width: auto;
    min-width: 160px;
}

.info-card {
    background: linear-gradient(180deg, rgba(var(--primary-light-rgb), 0.10), rgba(255, 255, 255, 0.95));
    border: 1px solid rgba(var(--primary-light-rgb), 0.28);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 18px;
}

.info-card p {
    margin: 0 0 8px;
    color: var(--text);
}

.info-card p:last-child {
    margin-bottom: 0;
}

/* Tabellendesign der bestellliste_folgequartal.php */
.bestellliste-page {
    margin: 24px auto 56px;
}

.bestellliste-page > .form-card {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.bestellliste-page .table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.bestell-table {
    width: 100%;
    min-width: 1320px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0 8px;
    font-size: 14px;
}

.bestell-table th {
    font-size: 13px;
    line-height: 1.35;
}

.bestell-table tbody tr {
    background: #fff;
    box-shadow: 0 2px 6px rgba(24, 49, 83, 0.04);
}

.bestell-table td {
    padding: 12px 8px;
    vertical-align: middle;
    border: none;
}

.bestell-details {
    margin-top: 6px;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.45;
}

.bestell-details summary {
    width: fit-content;
    max-width: 100%;
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
}

.bestell-details ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.bestell-details li + li {
    margin-top: 4px;
}

.bestellstatus-cell > small {
    display: block;
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.4;
}

.bestellstatus-erledigt,
.bestellstatus-offen {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--pill);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.bestellstatus-erledigt {
    color: #24543b;
    background: #e1f0e7;
}

.bestellstatus-offen {
    color: #495a70;
    background: #edf1f5;
}

.bestellstatus-editor {
    margin-top: 6px;
}

.bestellstatus-editor summary {
    width: fit-content;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.bestellstatus-editor form {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.bestellstatus-editor form label {
    display: grid;
    gap: 4px;
    font-size: 12px;
}

.bestellstatus-editor form .bestellstatus-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bestellstatus-editor input[type="date"],
.bestellstatus-editor input[type="text"] {
    width: 100%;
    min-width: 0;
    padding: 7px 9px;
    font-size: 12px;
}

.bestellstatus-editor .aktion-button {
    width: 100%;
    min-width: 0;
}

.charge-verteilung-form {
    max-width: none;
}

.charge-verteilung-page .quick-filter-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.charge-verteilung-heading {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 18px;
}

.charge-verteilung-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
}

.charge-verteilung-position {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(90px, 140px);
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.charge-verteilung-position label {
    margin: 0;
    overflow-wrap: anywhere;
}

.charge-verteilung-position input {
    width: 100%;
    margin: 0;
}

.charge-verteilung-summe {
    margin: 14px 0 0;
    color: var(--text-soft);
    font-weight: 700;
}

.charge-verteilung-summe.ist-korrekt {
    color: #24543b;
}

.charge-verteilung-summe.ist-unkorrekt {
    color: var(--expired-strong);
}

.datenbereinigung-settings-form {
    align-items: end;
}

.datenbereinigung-counts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 24px;
    padding-left: 20px;
}

.datenbereinigung-actions,
.datenbereinigung-action-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.datenbereinigung-confirm-form label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.formular.datenbereinigung-confirm-form input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.datenbereinigung-archive-list {
    display: grid;
    gap: 10px;
    padding: 0;
    list-style: none;
}

.datenbereinigung-archive-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.datenbereinigung-table th,
.datenbereinigung-table td {
    text-align: left;
    padding: 10px 14px;
}

.datenbereinigung-page code {
    overflow-wrap: anywhere;
}

.bestell-table tbody tr td:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.bestell-table tbody tr td:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.bestell-table .col-kategorie {
    width: 11%;
}

.bestell-table .col-produkt {
    width: 18%;
}

.bestell-table .col-lieferant {
    width: 11%;
}

.bestell-table .col-chargen {
    width: 6%;
}

.bestell-table .col-menge {
    width: 6%;
}

.bestell-table .col-einheit {
    width: 6%;
}

.bestell-table .col-verfall-frueh {
    width: 8%;
}
.bestell-table .col-verfall-spaet {
    width: 8%;
}
.bestell-table .col-grund {
    width: 13%;
}

.bestell-table .col-bestellstatus {
    width: 13%;
}

.bestell-table.ohne-lieferant .col-kategorie { width: 12%; }
.bestell-table.ohne-lieferant .col-produkt { width: 22%; }
.bestell-table.ohne-lieferant .col-chargen { width: 7%; }
.bestell-table.ohne-lieferant .col-menge { width: 8%; }
.bestell-table.ohne-lieferant .col-einheit { width: 8%; }
.bestell-table.ohne-lieferant .col-verfall-frueh { width: 9%; }
.bestell-table.ohne-lieferant .col-verfall-spaet { width: 9%; }
.bestell-table.ohne-lieferant .col-grund { width: 12%; }

/* Lieferantenliste mit klaren Spaltenabständen und linksbündigen Köpfen */
.lieferanten-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.lieferanten-table {
    width: 100%;
    min-width: 1120px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.lieferanten-table th,
.lieferanten-table td {
    padding: 12px 8px;
    text-align: left;
    vertical-align: middle;
}

.lieferanten-table th {
    white-space: nowrap;
}

.lieferanten-table td {
    overflow-wrap: anywhere;
}

.lieferanten-table .col-lieferantenname { width: 20%; }
.lieferanten-table .col-ansprechpartner { width: 18%; }
.lieferanten-table .col-kontakt { width: 24%; }
.lieferanten-table .col-produkte { width: 8%; }
.lieferanten-table .col-status { width: 10%; }
.lieferanten-table .col-aktionen { width: 20%; }

.anforderung-form {
    gap: 14px;
}

.umlagerung-form {
    gap: 14px;
}

.umlagerung-bestand-info {
    margin: 0;
    color: var(--text-soft);
}

.anforderung-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 20px;
    align-items: start;
}

.anforderung-form-field {
    min-width: 0;
}

.anforderung-form-field-menge input {
    max-width: 180px;
}

.anforderung-form-row-bedarf {
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
}

.anforderung-form-hinweis {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.4;
}

.formular .anforderung-admin-readonly {
    background: var(--surface-soft);
    color: var(--text-soft);
}

.anforderung-submit,
.form-action-button {
    justify-self: start;
    width: auto;
    min-width: 210px;
    min-height: 38px;
    padding: 8px 24px;
}

.anforderung-admin-action {
    width: 270px;
    max-width: 100%;
    min-width: 0;
}

.anforderungen-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.anforderungen-table {
    width: 100%;
    min-width: 1050px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.anforderungen-eigene-table { min-width: 1100px; }
.anforderungen-eigene-table .anfrage-col-nr { width: 3%; }
.anforderungen-eigene-table .anfrage-col-datum { width: 10%; }
.anforderungen-eigene-table .anfrage-col-ziel { width: 11%; }
.anforderungen-eigene-table .anfrage-col-produkt { width: 18%; }
.anforderungen-eigene-table .anfrage-col-menge { width: 9%; }
.anforderungen-eigene-table .anfrage-col-geliefert { width: 9%; }
.anforderungen-eigene-table .anfrage-col-status { width: 13%; }
.anforderungen-eigene-table .anfrage-col-begruendung { width: 18%; }
.anforderungen-eigene-table .anfrage-col-aktion { width: 9%; }

.anforderungen-historie-table { min-width: 1100px; }
.anforderungen-historie-table .anfrage-historie-col-nr { width: 3%; }
.anforderungen-historie-table .anfrage-historie-col-produkt { width: 21%; }
.anforderungen-historie-table .anfrage-historie-col-ziel { width: 15%; }
.anforderungen-historie-table .anfrage-historie-col-benutzer { width: 10%; }
.anforderungen-historie-table .anfrage-historie-col-menge { width: 15%; }
.anforderungen-historie-table .anfrage-historie-col-status { width: 11%; }
.anforderungen-historie-table .anfrage-historie-col-grund { width: 25%; }

.anforderungen-table th,
.anforderungen-table td {
    padding: 12px 4px;
    vertical-align: middle;
}

.anforderungen-table th {
    text-align: left;
}

.anforderungen-table tbody tr {
    background: #fff;
    box-shadow: 0 2px 6px rgba(24, 49, 83, 0.04);
}

.gesamtuebersicht-page {
    margin: 24px auto 56px;
}

.gesamtuebersicht-page .gesamtuebersicht-filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 240px));
    gap: 12px;
    align-items: stretch;
}

.gesamtuebersicht-page .gesamtuebersicht-filter-actions .aktion-button,
.gesamtuebersicht-page .gesamtuebersicht-filter-actions .aktion-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 38px;
    text-align: center;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.2;
}

.gesamtuebersicht-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.gesamtuebersicht-table {
    width: 100%;
    min-width: 1320px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0 8px;
}

/* Individuelle Spaltenbreiten der Gesamtübersicht */
.gesamtuebersicht-table .gesamt-col-ablage { width: 17%; }
.gesamtuebersicht-table .gesamt-col-produkt { width: 21%; }
.gesamtuebersicht-table .gesamt-col-kategorie { width: 12%; }
.gesamtuebersicht-table .gesamt-col-charge { width: 6%; }
.gesamtuebersicht-table .gesamt-col-verfall { width: 9%; }
.gesamtuebersicht-table .gesamt-col-bestand { width: 13%; }
.gesamtuebersicht-table .gesamt-col-status { width: 12%; }
.gesamtuebersicht-table .gesamt-col-ansicht { width: 10%; }

.gesamtuebersicht-table th,
.gesamtuebersicht-table td {
    padding: 8px 2px;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.gesamtuebersicht-table th {
    text-align: left;
}

.gesamtuebersicht-table tbody tr {
    background: #fff;
    box-shadow: 0 2px 6px rgba(24, 49, 83, 0.04);
}

.ta-center {
    text-align: center;
}

.ta-left {
    padding-left: 12px;
    text-align: left;
}

.ta-right {
    text-align: right;
}

.bestell-table-tools {
    margin-bottom: 16px;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.bestell-prefix-form {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.bestell-search {
    width: min(100%, 420px);
    padding: 10px 14px;
    border: 1px solid rgba(var(--primary-rgb), 0.18);
    border-radius: var(--pill);
    font: inherit;
    color: var(--text);
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.bestell-search:focus {
    outline: none;
    border-color: rgba(var(--primary-rgb), 0.45);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.12);
}

.modern-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.modern-table th.sortable::after {
    content: " ↕";
    opacity: 0.35;
    font-size: 0.85em;
}

.modern-table th.sortable.sort-asc::after {
    content: " ▲";
    opacity: 0.9;
}

.modern-table th.sortable.sort-desc::after {
    content: " ▼";
    opacity: 0.9;
}

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

/* Spaltenbreiten je Tabelle: Prozentwerte in den jeweiligen Klassen anpassen;
   die Prozentwerte pro Tabelle sollten zusammen 100 % ergeben. */
.verwaltung-table-wrap {
    width: 100%;
    overflow-x: auto;
}

/* Verwaltungstabellen */
.verwaltung-table {
    width: 100%;
    min-width: 850px;
    table-layout: fixed;
}

.formular .rollenrecht {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.formular .rollenrecht-checkbox {
    width: auto;
    flex: 0 0 auto;
}

.kategorien-table .kat-col-name { width: 44%; }
.kategorien-table .kat-col-count { width: 14%; }
.kategorien-table .kat-col-edit { width: 21%; }
.kategorien-table .kat-col-delete { width: 21%; }

.ablagen-table .ablage-col-name { width: 30%; }
.ablagen-table .ablage-col-products { width: 12%; }
.ablagen-table .ablage-col-stock { width: 22%; }
.ablagen-table .ablage-col-edit { width: 18%; }
.ablagen-table .ablage-col-delete { width: 18%; }

.verwaltung-table td {
    padding: 8px 2px;
    vertical-align: middle;
}

.verwaltung-table td:first-child {
    text-align: left;
}

.verwaltung-table td:nth-child(2) {
    text-align: center;
    font-weight: 600;
}

.verwaltung-table td:nth-child(3),
.verwaltung-table td:nth-child(4) {
    text-align: center;
}

.benutzerverwaltung-table {
    min-width: 1150px;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.benutzerverwaltung-table .benutzer-col-name { width: 20%; }
.benutzerverwaltung-table .benutzer-col-rolle { width: 25%; }
.benutzerverwaltung-table .benutzer-col-status { width: 12%; }
.benutzerverwaltung-table .benutzer-col-aktionen { width: 43%; }

.benutzerverwaltung-table th,
.benutzerverwaltung-table td {
    padding: 14px 18px;
    text-align: left;
    vertical-align: middle;
}

.benutzerverwaltung-table thead th {
    font-weight: 800;
}

.benutzerverwaltung-table tbody tr {
    background: #fff;
    box-shadow: 0 2px 6px rgba(24, 49, 83, 0.04);
}

.benutzerverwaltung-table tbody td:first-child {
    border-radius: 10px 0 0 10px;
    font-weight: 700;
}

.benutzerverwaltung-table tbody td:last-child {
    border-radius: 0 10px 10px 0;
}

.benutzerverwaltung-table td:nth-child(2),
.benutzerverwaltung-table td:nth-child(3),
.benutzerverwaltung-table td:nth-child(4) {
    text-align: left;
}

.benutzerverwaltung-table .benutzer-actions {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.benutzerverwaltung-table .benutzer-actions > .inline-form {
    width: auto;
    max-width: 100%;
    flex-wrap: wrap;
    margin: 0;
}

.benutzerverwaltung-table .inline-form select,
.benutzerverwaltung-table .inline-form input[type="password"] {
    min-width: 160px;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

.benutzerverwaltung-table details {
    flex: 0 0 auto;
}

.benutzerverwaltung-table details .inline-form {
    width: auto;
    margin: 8px 0 0;
}

.benutzerverwaltung-table details summary {
    cursor: pointer;
}

.benutzer-anlegen-form {
    grid-template-columns: minmax(170px, 1.1fr) minmax(250px, 1.6fr) minmax(170px, 0.9fr) auto;
    align-items: end;
    gap: 14px;
}

.benutzer-anlegen-form .form-group-full {
    grid-column: auto;
}

.benutzer-anlegen-form .form-actions,
.rolle-anlegen-form .form-actions {
    align-self: end;
    align-items: flex-end;
}

.benutzer-anlegen-form .form-button,
.rolle-anlegen-form .form-button {
    min-height: 38px;
}

.benutzer-anlegen-form .form-actions {
    white-space: nowrap;
}

.rolle-anlegen-form {
    align-items: end;
}

.abo-modell-card > p {
    max-width: 900px;
    color: var(--text-soft);
    line-height: 1.55;
}

.abo-modell-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px 18px;
    max-width: 760px;
    margin-top: 20px;
}

.abo-modell-form .form-group {
    flex: 1 1 280px;
}

.abo-modell-form .form-actions {
    margin-bottom: 0;
}

.abo-module-card ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 32px;
    max-width: 1000px;
    padding-left: 22px;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    width: 100%;
}

.inline-form input[type="text"] {
    width: 100%;
    min-width: 220px;
    padding: 10px 12px;
    text-align: left;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.inline-form input[type="text"]:focus {
    border-color: rgba(var(--primary-rgb), 0.35);
    box-shadow: 0 0 0 4px rgba(var(--primary-light-rgb), 0.16);
}

.verwaltung-table .mini-link {
    white-space: nowrap;
}

.cell-tasche,
.cell-produkt {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.cell-einheit,
.cell-datum {
    white-space: nowrap;
}

/* Messages */
.fehlerbox,
.erfolgbox {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.fehlerbox {
    background: var(--danger-soft);
    border-color: rgba(224, 133, 117, 0.35);
    color: #8f2d23;
}

.erfolgbox {
    background: var(--success-soft);
    border-color: rgba(64, 153, 96, 0.22);
    color: #245c24;
}

.erfolgbox-toast {
    margin-bottom: 18px;
    animation: fadeSlideIn 0.28s ease;
}

.charge-highlight {
    box-shadow:
        0 0 0 2px rgba(var(--primary-rgb), 0.18),
        0 8px 18px rgba(var(--primary-rgb), 0.08);
    animation: chargePulse 1.2s ease;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes chargePulse {
    0% {
        box-shadow:
            0 0 0 0 rgba(var(--primary-rgb), 0.28),
            0 8px 18px rgba(var(--primary-rgb), 0.08);
    }
    50% {
        box-shadow:
            0 0 0 4px rgba(var(--primary-rgb), 0.12),
            0 8px 18px rgba(var(--primary-rgb), 0.08);
    }
    100% {
        box-shadow:
            0 0 0 2px rgba(var(--primary-rgb), 0.18),
            0 8px 18px rgba(var(--primary-rgb), 0.08);
    }
}

.bewegungsprotokoll-wrap {
    width: 100%;
    max-width: 1500px;
    margin: 24px auto 56px;
    padding: 0 clamp(16px, 2.2vw, 36px);
}

.bewegungsprotokoll-wrap .table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.bewegungsprotokoll-table {
    width: 100%;
    min-width: 1320px;
    table-layout: fixed;
    border-collapse: collapse;
}

.bewegungsprotokoll-table .bewegung-col-zeitpunkt { width: 8%; }
.bewegungsprotokoll-table .bewegung-col-vorgang { width: 8%; }
.bewegungsprotokoll-table .bewegung-col-produkt { width: 20%; }
.bewegungsprotokoll-table .bewegung-col-von { width: 12%; }
.bewegungsprotokoll-table .bewegung-col-nach { width: 12%; }
.bewegungsprotokoll-table .bewegung-col-menge { width: 10%; }
.bewegungsprotokoll-table .bewegung-col-benutzer { width: 10%; }
.bewegungsprotokoll-table .bewegung-col-grund { width: 20%; }

.bewegungsprotokoll-table th,
.bewegungsprotokoll-table td {
    padding: 10px 8px;
    vertical-align: top;
    text-align: left;
    line-height: 1.45;
}

.bewegungsprotokoll-table tbody tr {
    border-bottom: 1px solid var(--border);
}

.bewegungsprotokoll-table tbody tr:last-child {
    border-bottom: 0;
}

/* Selectfeld und Inhaltsbutton in einer Zeile */
.formular-auswahl-aktion {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.bestandsgrenzen-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.bestandsgrenzen-global-table { min-width: 850px; }
.bestandsgrenzen-global-table .grenze-col-produkt { width: 34%; }
.bestandsgrenzen-global-table .grenze-col-status { width: 22%; }
.bestandsgrenzen-global-table .grenze-col-bestand { width: 22%; }
.bestandsgrenzen-global-table .grenze-col-grenze { width: 22%; }

.bestandsgrenzen-ablage-table { min-width: 1050px; }
.bestandsgrenzen-ablage-table .grenze-col-produkt { width: 28%; }
.bestandsgrenzen-ablage-table .grenze-col-ablage { width: 22%; }
.bestandsgrenzen-ablage-table .grenze-col-status { width: 18%; }
.bestandsgrenzen-ablage-table .grenze-col-bestand { width: 16%; }
.bestandsgrenzen-ablage-table .grenze-col-grenze { width: 16%; }

.bestandsgrenzen-table th,
.bestandsgrenzen-table td {
    padding: 10px 8px;
    vertical-align: middle;
}

.bestandsgrenzen-table th {
    text-align: left;
}

.bestandsgrenzen-table th:not(:first-child),
.bestandsgrenzen-table td:not(:first-child) {
    padding-left: 32px;
}

/* Einheitliche, leicht reduzierte Schriftgröße für zentrale Tabellen */
.gesamtuebersicht-table,
.anforderungen-table,
.bewegungsprotokoll-table,
.bestandsgrenzen-table,
.inventur-table {
    font-size: 15px;
}

.inventur-table input {
    font-size: inherit;
}

.inventur-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.inventur-erfassung-table,
.inventur-detail-table { min-width: 1120px; }
.inventur-erfassung-table .inventur-col-produkt,
.inventur-detail-table .inventur-col-produkt { width: 28%; }
.inventur-erfassung-table .inventur-col-verfall,
.inventur-detail-table .inventur-col-verfall { width: 12%; }
.inventur-erfassung-table .inventur-col-soll,
.inventur-detail-table .inventur-col-soll { width: 16%; }
.inventur-erfassung-table .inventur-col-ist,
.inventur-detail-table .inventur-col-ist { width: 12%; }
.inventur-erfassung-table .inventur-col-grund,
.inventur-detail-table .inventur-col-grund { width: 32%; }

.inventur-historie-table { min-width: 1120px; }
.inventur-historie-table .historie-col-nr { width: 5%; }
.inventur-historie-table .historie-col-ablage { width: 30%; }
.inventur-historie-table .historie-col-status { width: 15%; }
.inventur-historie-table .historie-col-datum { width: 25%; }
.inventur-historie-table .historie-col-aktion { width: 25%; }

.inventur-erfassung-table input[name^="ist_menge"] {
    width: 100%;
    box-sizing: border-box;
}

.inventur-erfassung-table input[name^="begruendung"] {
    width: 90%;
    box-sizing: border-box;
}

.inventur-table th,
.inventur-table td {
    padding: 12px 8px;
    vertical-align: middle;
}

.inventur-table th {
    text-align: left;
}

.inventur-table th:not(:first-child),
.inventur-table td:not(:first-child) {
    padding-left: 32px;
}

/* Gemeinsame Hauptnavigation */
body.has-app-sidebar {
    padding-left: 254px;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    width: 254px;
    padding: 24px 14px 16px;
    overflow-y: auto;
    color: #fff;
    background: linear-gradient(180deg, var(--primary), var(--primary-hover));
    box-shadow: 8px 0 28px rgba(20, 43, 68, 0.12);
}

.app-sidebar-brand {
    display: block;
    margin: 0 10px 28px;
    color: #fff;
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.app-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-nav-heading {
    margin: 18px 10px 5px;
    color: var(--primary-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-nav-heading:first-child {
    margin-top: 0;
}

.app-nav-link {
    display: block;
    padding: 10px 11px;
    border-radius: 9px;
    color: var(--primary-light);
    font-size: 14px;
    line-height: 1.3;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.app-nav-link-with-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.app-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid rgba(var(--accent-rgb), 0.36);
    border-radius: var(--pill);
    background: var(--warning-soft);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.app-nav-link:hover,
.app-nav-link.active {
    color: #fff;
    background: rgba(var(--primary-hover-soft-rgb), 0.22);
}

.app-nav-link.active {
    box-shadow: inset 3px 0 var(--primary-highlight);
    font-weight: 700;
}

.app-sidebar-account {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid rgba(var(--primary-light-rgb), 0.16);
}

.app-sidebar-account > span {
    padding: 0 11px 7px;
    color: var(--primary-muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.app-logout-form {
    margin: 0;
}

.app-logout-form button.app-nav-link {
    width: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    text-align: left;
}

.app-nav-trigger,
.app-nav-backdrop {
    display: none;
}

/* Responsive Layouts: Breakpoints absteigend, kleinere Ansichten überschreiben größere */
@media (max-width: 1100px) {
    body.has-app-sidebar {
        padding-left: 0;
    }

    .app-sidebar {
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }

    body.app-sidebar-open {
        overflow: hidden;
    }

    body.app-sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-nav-trigger {
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 1190;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-height: 42px;
        padding: 0 14px;
        border: 1px solid var(--border);
        border-radius: 11px;
        color: var(--text);
        background: #fff;
        box-shadow: var(--shadow-soft);
        font: inherit;
        font-weight: 700;
        cursor: pointer;
    }

    .app-nav-backdrop:not([hidden]) {
        position: fixed;
        inset: 0;
        z-index: 1195;
        display: block;
        border: 0;
        background: rgba(12, 28, 46, 0.42);
    }

    .has-app-sidebar .wrap {
        padding-top: 68px;
    }
}

@media (max-width: 900px) {
    .formular.formular-zweispaltig.benutzer-anlegen-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .benutzer-anlegen-form .form-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    .expiry-alert-grid {
        grid-template-columns: 1fr;
    }

    .header-bar,
    .form-page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .header-bar > div:last-child {
        width: 100%;
    }

    .header-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-filter-bar {
        grid-template-columns: repeat(3, 1fr);
    }

    .produkt-kopf {
        flex-direction: column;
        align-items: flex-start;
    }

    .produkt-summary {
        grid-template-columns: minmax(0, 1fr) auto 18px;
        justify-content: stretch;
    }

    .produkt-meta {
        text-align: left;
    }

    .produkt-aktionen {
        width: 100%;
        justify-content: flex-start;
    }

    .produkt-aktionen .aktion-link,
    .produkt-aktionen .aktion-loeschen {
        min-width: 0;
        flex: 1 1 140px;
    }

    .chargen-liste li,
    .warnliste li {
        flex-direction: column;
        align-items: flex-start;
    }

    .charge-links,
    .charge-rechts,
    .charge-actions {
        width: 100%;
    }

    .charge-rechts {
        justify-content: flex-start;
        gap: 10px;
    }

    .charge-actions {
        justify-content: flex-start;
    }

    .formular-zweispaltig {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-button {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .anforderung-form-row,
    .anforderung-form-row-bedarf,
    .formular-auswahl-aktion {
        grid-template-columns: 1fr;
    }

    .charge-verteilung-grid {
        grid-template-columns: 1fr;
    }

    .charge-verteilung-page .quick-filter-bar {
        grid-template-columns: 1fr;
    }

    .datenbereinigung-counts {
        grid-template-columns: 1fr;
    }

    .datenbereinigung-archive-list li {
        align-items: flex-start;
        flex-direction: column;
    }

    .lieferanten-table th,
    .lieferanten-table td,
    .anforderungen-table th,
    .anforderungen-table td,
    .gesamtuebersicht-table th,
    .gesamtuebersicht-table td,
    .bestandsgrenzen-table th,
    .bestandsgrenzen-table td,
    .inventur-table th,
    .inventur-table td {
        padding: 12px 16px;
    }

    .bestandsgrenzen-table th:not(:first-child),
    .bestandsgrenzen-table td:not(:first-child),
    .inventur-table th:not(:first-child),
    .inventur-table td:not(:first-child) {
        padding-left: 22px;
    }
}

@media (max-width: 600px) {
    .abo-module-card ul {
        grid-template-columns: 1fr;
    }

    .formular.formular-zweispaltig.benutzer-anlegen-form {
        grid-template-columns: 1fr;
    }

    .benutzer-anlegen-form .form-actions {
        grid-column: auto;
    }

    .wrap-log {
        margin: 20px;
    }

    .header-actions {
        grid-template-columns: 1fr;
    }

    .header-actions a.aktion-link,
    .header-actions button.aktion-button {
        width: 60%;
        margin: 0 auto;
    }

    .quick-filter-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-filter {
        flex: 1 1 calc(50% - 8px);
    }

    .active-filter-bar {
        gap: 6px;
    }

    .active-filter-chip {
        font-size: 11px;
    }

    .bestell-table-tools {
        justify-content: center;
    }

    .bestell-prefix-form {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: start;
    }

    .bestell-search {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .gesamtuebersicht-page .gesamtuebersicht-filter-actions {
        grid-template-columns: 1fr;
    }

    .bestell-prefix-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bestell-prefix-form .bestell-search {
        grid-column: 1 / -1;
    }

    .wrap {
        margin-top: 24px;
        padding: 0 14px 24px;
    }

    .header-actions a.aktion-link,
    .header-actions button.aktion-button {
        width: 100%;
    }

    .filter-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .produkt-summary {
        grid-template-columns: 1fr auto 18px;
        align-items: start;
    }

    .produkt-meta {
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .charge-actions {
        gap: 7px;
    }

    .charge-actions .mini-link {
        padding: 6px 8px;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 7mm 7mm 7mm 12mm;
    }

    body {
        font-size: 10pt;
    }

    body.has-app-sidebar {
        padding-left: 0;
    }

    .bestellliste-page {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0 7mm 0 12mm;
    }

    .gesamtuebersicht-page {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0 7mm 0 12mm;
    }

    .gesamtuebersicht-page .form-page-head {
        margin: 0 0 8px;
        padding: 0 0 8px;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .gesamtuebersicht-page .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 8px;
    }

    .gesamtuebersicht-page .stat-card {
        padding: 6px 8px;
        box-shadow: none;
    }

    .gesamtuebersicht-page .info-card {
        padding: 6px 8px;
        margin-bottom: 8px;
        box-shadow: none;
    }

    .gesamtuebersicht-filter-card,
    .gesamtuebersicht-page .header-actions {
        display: none !important;
    }

    .gesamtuebersicht-page > .form-card {
        padding: 0;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .gesamtuebersicht-page > .form-card h2 {
        margin: 0 0 5px;
        font-size: 11pt;
    }

    .gesamtuebersicht-table-wrap {
        width: 100%;
        overflow: visible;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .gesamtuebersicht-table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
        font-size: 7.5pt;
    }

    .gesamtuebersicht-table th,
    .gesamtuebersicht-table td {
        padding: 2px 3px;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .gesamtuebersicht-table .gesamt-col-ablage { width: 16%; }
    .gesamtuebersicht-table .gesamt-col-produkt { width: 20%; }
    .gesamtuebersicht-table .gesamt-col-kategorie { width: 13%; }
    .gesamtuebersicht-table .gesamt-col-charge { width: 7%; }
    .gesamtuebersicht-table .gesamt-col-verfall { width: 10%; }
    .gesamtuebersicht-table .gesamt-col-bestand { width: 14%; }
    .gesamtuebersicht-table .gesamt-col-status { width: 20%; }

    .gesamtuebersicht-table th:last-child,
    .gesamtuebersicht-table td:last-child {
        display: none;
    }

    .gesamtuebersicht-table tbody tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .gesamtuebersicht-table thead {
        display: table-header-group;
    }

    .bestellliste-page .table-wrap {
        width: 100%;
        overflow: visible;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .modern-table {
        font-size: 9pt;
    }

    .modern-table th,
    .modern-table td {
        padding: 3px 5px;
    }

    .bestell-table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
        border-spacing: 0;
        font-size: 7pt;
    }

    .bestell-table th {
        font-size: 6.5pt;
        line-height: 1.1;
    }

    .bestell-table th,
    .bestell-table td {
        padding: 2px 3px;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .bestell-table tbody tr {
        box-shadow: none;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .bestell-table thead {
        display: table-header-group;
    }

    .bestell-details {
        margin-top: 2px;
        font-size: 5.5pt;
        line-height: 1.1;
    }

    .bestellstatus-cell > small,
    .bestellstatus-erledigt,
    .bestellstatus-offen {
        font-size: 5.5pt;
        line-height: 1.1;
    }

    .bestellstatus-erledigt,
    .bestellstatus-offen {
        padding: 1px 3px;
    }

    .bestellstatus-editor {
        display: none;
    }

    .header-actions,
    .bestell-table-tools,
    .app-sidebar,
    .app-nav-trigger {
        display: none;
    }

    .app-nav-backdrop:not([hidden]) {
        display: none;
    }
}
