﻿/* Portal-spezifische Styles */

/* Design-Tokens: Radien, Flächen, Borders, Schatten */
:root {
    --brand: #0d6efd;
    --brand-dark: #0b5ed7;
    --bg: #f4f6f9;
    --text: #212529;
    --muted: #6c757d;
    --card-border: rgba(0, 0, 0, 0.08);
    --border: var(--card-border);
    --border-input: #ced4da;
    --surface: #fff;
    --surface-hover: #f1f3f5;
    --surface-muted: #eef2f7;
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.08), 0 12px 32px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.16);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.22);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

/* Schriftgröße: zentrale rem-Skalierung über html-Root.
   Inhaltsbreite waechst mit der Schriftstufe (960 / 1100 / 1240),
   damit Gross/Sehr gross den vorhandenen Platz nutzen. */
html {
    --app-font-scale: 1;
    --app-content-max-width: 960px;
    --app-content-pad-x: 1rem;
    --media-dialog-width: min(960px, calc(100vw - 1.5rem));
    --media-dialog-height: min(85dvh, calc(100dvh - 1.5rem));
    font-size: calc(100% * var(--app-font-scale));
}

html.font-size-normal,
body.font-size-normal {
    --app-font-scale: 1;
    --app-content-max-width: 960px;
    --app-content-pad-x: 1rem;
    --media-dialog-width: min(960px, calc(100vw - 1.5rem));
    --media-dialog-height: min(85dvh, calc(100dvh - 1.5rem));
}

html.font-size-large,
body.font-size-large {
    --app-font-scale: 1.125;
    --app-content-max-width: 1100px;
    --app-content-pad-x: 0.75rem;
    --media-dialog-width: min(1180px, 92vw);
    --media-dialog-height: min(90dvh, calc(100dvh - 1rem));
}

html.font-size-xlarge,
body.font-size-xlarge {
    --app-font-scale: 1.25;
    --app-content-max-width: 1240px;
    --app-content-pad-x: 0.6rem;
    --media-dialog-width: min(96vw, calc(100vw - 0.75rem));
    --media-dialog-height: min(94dvh, calc(100dvh - 0.75rem));
}

/* Sticky-Header: Basis in layouts/main.php (.portal-header).
   z-index 200: ueber Content, unter Scanner/Modals/Confirm. */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 200;
}

/* Zentrale Breitenregel fuer Header und Hauptinhalt (Dashboard + Vorgang) */
.portal-header__inner,
.portal-main {
    width: 100%;
    max-width: var(--app-content-max-width);
    box-sizing: border-box;
}

/* Overlay/Spinner nicht überproportional mitwachsen */
.page-loading__panel .spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: 0.2em;
}

html.font-size-large .page-loading__panel .spinner-border,
html.font-size-xlarge .page-loading__panel .spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Header-Aktionen (Aktiv-Badge + Schriftgröße + Vollbild + Logout) */
.portal-header__actions {
    --header-control-size: 2.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 0 1 auto;
    min-width: 0;
}

/* Einheitliche Höhe, Radius und Border für alle Header-Controls */
.portal-active,
.btn-font-size,
.btn-fullscreen,
.portal-header__actions .btn-logout {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--header-control-size);
    height: var(--header-control-size);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
}

.font-size-control {
    position: relative;
    flex: 0 0 auto;
}

.btn-font-size,
.btn-fullscreen {
    width: var(--header-control-size);
    padding: 0;
    cursor: pointer;
    border-color: #343a40;
    background: linear-gradient(180deg, #868e96 0%, #6c757d 45%, #495057 100%);
    color: #fff;
    box-shadow: 0 1px 3px rgba(33, 37, 41, 0.28);
}

.btn-font-size:hover,
.font-size-control.is-open .btn-font-size,
.btn-fullscreen:hover {
    border-color: #212529;
    background: linear-gradient(180deg, #adb5bd 0%, #6c757d 40%, #343a40 100%);
    color: #fff;
}

.btn-font-size:focus-visible,
.btn-fullscreen:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.btn-font-size__label {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    user-select: none;
}

.font-size-menu {
    position: absolute;
    top: calc(100% + 0.3rem);
    right: 0;
    z-index: 40;
    min-width: 8.5rem;
    margin: 0;
    padding: 0.3rem;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.font-size-menu[hidden] {
    display: none !important;
}

.font-size-menu__item {
    display: block;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #212529;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.font-size-menu__item:hover,
.font-size-menu__item:focus-visible {
    background: #e7f1ff;
    color: #084298;
    outline: none;
}

.font-size-menu__item.is-active {
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 650;
}

.font-size-menu__item.is-active::after {
    content: ' ✓';
    font-weight: 700;
}

.btn-fullscreen {
    line-height: 0;
    font-size: 1.05rem;
}

.btn-fullscreen .bi {
    display: block;
    line-height: 1;
}

/* Kompakter Header: Logo + Techniker-Badge links | Aktionen rechts */
.portal-header__inner {
    --header-control-size: 2.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem 1rem;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.portal-identity {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.1rem;
    min-width: 0;
    font-size: 0.95rem;
    line-height: 1.3;
    color: #fff;
}

.brand-prefix {
    font-weight: 700;
}

.brand-suffix {
    font-weight: 400;
}

.header-brand.brand-link:has(.header-logo) {
    display: inline-flex;
    align-items: center;
    height: var(--header-control-size, 2.25rem);
    padding: 0;
    gap: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: 0 1px 2px rgba(33, 37, 41, 0.18);
}

.header-logo {
    display: block;
    height: calc(var(--header-control-size, 2.25rem) - 0.2rem);
    max-height: calc(var(--header-control-size, 2.25rem) - 0.2rem);
    width: auto;
    max-width: min(10.5rem, 38vw);
    margin: 0.1rem 0.35rem;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
}

.header-brand.brand-link:has(.header-logo):hover,
.header-brand.brand-link:has(.header-logo):focus {
    opacity: 1;
}

.header-brand.brand-link:has(.header-logo):hover .header-logo {
    filter: brightness(0.97);
}

.technician-badge {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.3rem 0.45rem;
    min-height: var(--header-control-size, 2.25rem);
    padding: 0 0.75rem;
    border: 1px solid #343a40;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #868e96 0%, #6c757d 45%, #495057 100%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(33, 37, 41, 0.28);
    text-shadow: 0 1px 1px rgba(33, 37, 41, 0.35);
    white-space: nowrap;
}

.technician-badge .header-separator {
    opacity: 0.7;
    color: #fff;
}

.technician-badge .technician-name,
.technician-badge .technician-number,
.technician-badge .technician-department {
    font-weight: 600;
    color: #fff;
}

.portal-active {
    padding: 0 0.75rem;
    border-color: #0b5ed7;
    background: linear-gradient(180deg, #6ea8fe 0%, #3d8bfd 40%, #0d6efd 100%);
    color: #fff;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(13, 110, 253, 0.4);
    text-shadow: 0 1px 1px rgba(11, 94, 215, 0.4);
}

.portal-header__actions .btn-logout {
    width: var(--header-control-size);
    min-width: var(--header-control-size);
    margin-left: 0.45rem;
    padding: 0;
    border-color: #842029;
    background: linear-gradient(180deg, #f07178 0%, #dc3545 45%, #b02a37 100%);
    color: #fff;
    font-size: 1.1rem;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(176, 42, 55, 0.35);
}

.portal-header__actions .btn-logout .bi {
    line-height: 1;
    color: #fff;
}

.portal-header__actions .btn-logout:hover {
    border-color: #6a1a21;
    background: linear-gradient(180deg, #e35d6a 0%, #bb2d3b 45%, #8b212b 100%);
    color: #fff;
}

.portal-header__actions .btn-logout:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Aktionszeile: Scannen + Suche */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    padding: 0.55rem 1rem;
    border: 1px solid #0b5ed7;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #6ea8fe 0%, #3d8bfd 40%, #0d6efd 100%);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(13, 110, 253, 0.35);
    text-shadow: 0 1px 1px rgba(11, 94, 215, 0.35);
}

.btn-action .bi {
    font-size: 1.1rem;
    line-height: 1;
}

.btn-action:hover:not(:disabled) {
    border-color: #0a58ca;
    background: linear-gradient(180deg, #3d8bfd 0%, #0d6efd 45%, #0a58ca 100%);
}

/* Dashboard: Scannen + Suchen – Graustufen-Verlauf (etwas heller) */
.btn-action--scan,
.action-search__btn {
    border-color: #495057;
    background: linear-gradient(180deg, #adb5bd 0%, #868e96 45%, #6c757d 100%);
    box-shadow: 0 1px 3px rgba(73, 80, 87, 0.28);
    text-shadow: 0 1px 1px rgba(73, 80, 87, 0.3);
}

.btn-action--scan:hover:not(:disabled),
.action-search__btn:hover:not(:disabled) {
    border-color: #343a40;
    background: linear-gradient(180deg, #ced4da 0%, #868e96 40%, #495057 100%);
}

.btn-action:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.action-search {
    display: flex;
    flex: 1 1 22rem;
    min-width: 0;
    gap: 0.5rem;
}

.action-search__input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 2.75rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--surface);
}

.action-search__input:disabled {
    background: var(--surface-hover);
    color: #868e96;
    cursor: not-allowed;
}

.action-search__btn {
    flex: 0 0 auto;
}

.action-bar + .search-hint {
    margin: -0.6rem 0 1rem;
    font-size: 0.78rem;
    color: var(--muted, #6c757d);
}

/* Ergebnisbereich der Auftragssuche */
.search-result {
    margin-bottom: 1rem;
}

.search-notice {
    margin: 0;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand, #0d6efd);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: #495057;
    font-size: 0.92rem;
    box-shadow: var(--shadow-sm);
}

.search-notice--small {
    font-size: 0.82rem;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.6rem;
}

.search-echo {
    margin: 0 0 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text, #212529);
    word-break: break-word;
}

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 1rem;
}

.result-card__kunde {
    margin: 0 0 0.35rem;
    font-size: 1.08rem;
    font-weight: 700;
    color: #212529;
    word-break: break-word;
}

.result-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
    margin-bottom: 0.5rem;
}

.result-card__title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 600;
}

.result-card__id {
    font-size: 0.78rem;
    color: var(--muted, #6c757d);
}

.result-card__subtitle {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6c757d;
}

.result-card__body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin: 0.35rem 0 0.75rem;
    align-items: start;
}

@media (min-width: 1200px) {
    .result-card__body {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.65rem 1.25rem;
        align-items: start;
    }
}

.result-card__col--info .result-card__kunde {
    margin-bottom: 0.3rem;
}

.result-card__col--info .result-card__head {
    margin-bottom: 0.45rem;
}

.result-card__col--info .result-actions {
    margin-top: 0.75rem;
}

.result-card__col--info,
.result-card__col--termine {
    min-width: 0;
    align-self: start;
}

.result-card__col--info .result-badges {
    margin-bottom: 0.45rem;
}

.result-card__col--info .booking-status,
.result-card__col--info .booking-actives {
    margin-bottom: 0.45rem;
}

.result-card__col--info .result-meta {
    margin-bottom: 0;
}

.result-card__col--termine .result-card__subtitle {
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.result-termine {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8f9fa;
    overflow: hidden;
}

.result-termine__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 0.65rem;
    padding: 0.4rem 0.55rem;
    border-top: 1px solid #e9ecef;
}

.result-termine__row:first-child {
    border-top: 0;
}

.result-termine__row--canceled {
    background: #fff5f5;
}

.tec-appointment--canceled {
    color: var(--bs-danger, #dc3545);
    text-decoration: line-through;
}

.tec-appointment--canceled .result-termine__when,
.tec-appointment--canceled .result-termine__name {
    color: inherit;
    text-decoration: inherit;
}

.result-termine__art.tec-appointment--canceled {
    color: var(--bs-danger, #dc3545);
    text-decoration: line-through;
    background: #f8d7da;
}

.result-termine__main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.55rem;
    min-width: 0;
    flex: 1 1 12rem;
}

.result-termine__when {
    flex: 0 0 auto;
    font-size: 0.86rem;
    font-weight: 500;
    color: #343a40;
    white-space: nowrap;
}

.result-termine__name {
    flex: 1 1 8rem;
    font-size: 0.9rem;
    font-weight: 400;
    color: #212529;
    word-break: break-word;
}

.result-termine__flags {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    flex: 0 0 auto;
    margin-left: auto;
}

.result-termine__art,
.result-termine__status {
    display: inline-flex;
    align-items: center;
    padding: 0.08rem 0.38rem;
    border-radius: var(--radius-sm, 0.25rem);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
}

.result-termine__art {
    background: #e9ecef;
    color: #495057;
}

.result-termine__status--offen {
    background: #d1e7dd;
    color: #0f5132;
}

.result-termine__status--erledigt {
    background: #cff4fc;
    color: #055160;
}

.result-termine__status--storniert {
    background: #f8d7da;
    color: #842029;
}

.result-meta {
    margin: 0 0 0.6rem;
    display: grid;
    gap: 0.2rem;
}

.result-meta__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.9rem;
}

.result-meta__row dt {
    margin: 0;
    min-width: 6.5rem;
    color: var(--muted, #6c757d);
    font-weight: 600;
}

.result-meta__row dd {
    margin: 0;
    word-break: break-word;
}

.result-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.55rem;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    color: #343a40;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge--category {
    background: #e7f1ff;
    color: #084298;
}

.badge--department {
    background: #e9ecef;
    color: #343a40;
}

.badge--warn {
    background: #fff3cd;
    color: #664d03;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

/* Einbuchungsstatus */
.booking-flash {
    margin: 0 0 0.6rem;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 600;
}

.booking-flash--success {
    color: #0f5132;
    background: #d1e7dd;
}

.booking-flash--notice {
    color: #664d03;
    background: #fff3cd;
}

.booking-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.6rem;
    font-size: 0.92rem;
}

.booking-status--active {
    color: #0f5132;
}

.booking-status--active .bi {
    color: #198754;
}

.booking-status--unknown {
    color: #664d03;
}

.booking-actives {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
}

.booking-actives__label {
    font-weight: 600;
    color: var(--text, #212529);
}

.booking-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #e9ecef;
    color: #343a40;
    white-space: nowrap;
}

.booking-form {
    margin: 0;
}

.btn-compact--primary {
    border-color: var(--brand, #478ffa);
    background: var(--brand, #0d6efd);
    color: #fff;
}

.btn-compact--primary:hover:not(:disabled) {
    filter: brightness(0.95);
    color: #fff;
}

.result-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.result-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.result-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.result-list__info {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.result-list__aufnr {
    font-weight: 600;
    font-size: 0.92rem;
}

.result-list__line {
    font-size: 0.85rem;
    color: #495057;
    word-break: break-word;
}

.result-list__meta {
    font-size: 0.78rem;
    color: var(--muted, #6c757d);
}

.result-list__select {
    flex: 0 0 auto;
    margin: 0;
}

/* Bereich "Meine Arbeiten" */
.works {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.1rem 1.2rem;
}

.works__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.works__head-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    margin-left: auto;
}

.works__head-actions .btn-refresh {
    margin-left: 0;
}

.works__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.works__count {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    color: var(--muted, #6c757d);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.works__empty {
    padding: 0.5rem 0 0.25rem;
}

.works__empty-text {
    margin: 0 0 0.85rem;
    color: #495057;
    font-size: 0.95rem;
}

.works__empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text, #212529);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-compact .bi {
    font-size: 1rem;
    line-height: 1;
}

.btn-compact:hover:not(:disabled) {
    border-color: var(--brand, #0d6efd);
    color: var(--brand, #0d6efd);
}

.btn-compact:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.works__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.works__item {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.works__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 0 0.15rem 0.15rem;
}

.works__unbook {
    width: auto;
    margin: 0;
    min-height: 2.25rem;
    padding: 0.35rem 0.7rem;
    gap: 0.35rem;
}

/* Touch-optimierte volle Zeile (min. ~48–56px) */
.works__row {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 3.5rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    transition: background-color 0.12s ease, border-color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

a.works__row:hover {
    border-color: rgba(13, 110, 253, 0.35);
    background: #f5f8ff;
    color: inherit;
    text-decoration: none;
}

a.works__row:active {
    background: #eaf1ff;
}

a.works__row:focus-visible {
    outline: 2px solid var(--brand, #0d6efd);
    outline-offset: 2px;
}

.works__row--disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.works__info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1 1 auto;
}

.works__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
}

.works__aufnr {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.25;
}

.works__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    background: #e7f1ff;
    color: #084298;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.works__line {
    font-size: 0.9rem;
    color: #495057;
    word-break: break-word;
    line-height: 1.3;
}

.works__line--muted {
    color: var(--muted, #6c757d);
}

.works__meta {
    font-size: 0.8rem;
    color: var(--muted, #6c757d);
    line-height: 1.3;
}

.works__go {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--brand, #0d6efd);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.works__go .bi {
    font-size: 1.1rem;
    line-height: 1;
}

.works__row--disabled .works__go {
    color: var(--muted, #6c757d);
}

/* Klickbarer Markenname als Link zur Übersicht */
.brand-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.brand-link:hover,
.brand-link:focus {
    text-decoration: none;
    opacity: 0.92;
}

.brand-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Einmalige Flash-Meldungen: Darstellung ueber TecToast (Layout bootet JSON). */
.flash-alert {
    display: none;
}

/* Portalweite Toasts: ueber Header (200), unter Scanner/Modal/Confirm (>=1000) */
.tec-toast-container {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 4.5rem);
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    z-index: 250;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    width: min(22rem, calc(100vw - 1.5rem));
    max-width: calc(100vw - 1.5rem);
    pointer-events: none;
}

.tec-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    width: 100%;
    padding: 0.65rem 0.7rem;
    border-radius: var(--radius-md, 0.5rem);
    border: 1px solid transparent;
    box-shadow: 0 6px 20px rgba(33, 37, 41, 0.16);
    background: #fff;
    color: var(--text, #212529);
    font-size: 0.92rem;
    line-height: 1.35;
    opacity: 0;
    transform: translateX(0.6rem);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.tec-toast--show {
    opacity: 1;
    transform: translateX(0);
}

.tec-toast__icon {
    flex: 0 0 auto;
    margin-top: 0.1rem;
    font-size: 1.1rem;
    line-height: 1;
}

.tec-toast__body {
    flex: 1 1 auto;
    min-width: 0;
}

.tec-toast__title {
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.tec-toast__message {
    word-break: break-word;
}

.tec-toast__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    margin: -0.15rem -0.15rem 0 0;
    border: 0;
    border-radius: var(--radius-sm, 0.375rem);
    background: transparent;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
}

.tec-toast__close:hover,
.tec-toast__close:focus-visible {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
    outline: none;
}

.tec-toast--success {
    background: #edf7f0;
    border-color: #badbcc;
    color: #0f5132;
}

.tec-toast--error {
    background: #fdf2f4;
    border-color: #f5c2c7;
    color: #842029;
}

.tec-toast--warning {
    background: #fff8e6;
    border-color: #ffe69c;
    color: #664d03;
}

.tec-toast--info {
    background: #eef4fb;
    border-color: #cfe2ff;
    color: #084298;
}

@media (max-width: 576px) {
    .tec-toast-container {
        right: max(0.5rem, env(safe-area-inset-right, 0px));
        left: max(0.5rem, env(safe-area-inset-left, 0px));
        width: auto;
        max-width: none;
        align-items: stretch;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tec-toast {
        transition: none;
        transform: none;
    }
}

@media (max-width: 576px) {
    .portal-header__actions {
        gap: 0.4rem;
    }

    .portal-identity {
        gap: 0.55rem 0.75rem;
    }

    .action-search {
        flex-basis: 100%;
    }

    .result-list__item {
        flex-direction: column;
        align-items: stretch;
    }

    .result-list__select .btn-compact {
        width: 100%;
        justify-content: center;
    }

    .works__row {
        min-height: 3.75rem;
        padding: 0.85rem 0.9rem;
    }

    .works__go-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .works__go {
        align-self: center;
        padding-left: 0.25rem;
    }
}

/* QR-Scanner-Overlay */
body.scanner-open {
    overflow: hidden;
}

.scanner-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    box-sizing: border-box;
}

.scanner-overlay[hidden] {
    display: none;
}

.scanner-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.scanner-dialog {
    --scanner-chrome: 12rem;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 30rem;
    max-height: min(92dvh, calc(100dvh - 1.5rem));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
}

.scanner-dialog__head {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex: 0 0 auto;
}

.scanner-dialog__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.scanner-close {
    position: relative;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text, #212529);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    flex: 0 0 auto;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.scanner-close .bi {
    pointer-events: none;
}

.scanner-close:hover {
    border-color: var(--brand, #0d6efd);
    color: var(--brand, #0d6efd);
}

/*
  Video-Flaeche: stabiles 4:3. Bei knapper Viewport-Hoehe (oder grosser rem-
  Schrift) die Breite begrenzen, statt die Hoehe zum flachen Streifen zu quetschen.
*/
.scanner-video-wrap {
    position: relative;
    flex: 0 1 auto;
    width: min(100%, calc((100dvh - var(--scanner-chrome, 12rem)) * 4 / 3));
    max-width: 100%;
    min-height: 14rem;
    max-height: min(56dvh, calc(100dvh - var(--scanner-chrome, 12rem)));
    aspect-ratio: 4 / 3;
    height: auto;
    margin-inline: auto;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    align-self: center;
}

.scanner-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.scanner-hint {
    margin: 0;
    font-size: 0.9rem;
    color: #495057;
    text-align: center;
    flex: 0 0 auto;
}

.scanner-error {
    margin: 0;
    padding: 0.6rem 0.8rem;
    border: 1px solid #f5c2c7;
    border-radius: var(--radius-md);
    background: #f8d7da;
    color: #842029;
    font-size: 0.9rem;
    flex: 0 0 auto;
}

.scanner-error[hidden] {
    display: none;
}

.scanner-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex: 0 0 auto;
}

.scanner-camera {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 12rem;
    min-width: 0;
    font-size: 0.85rem;
}

.scanner-camera[hidden] {
    display: none;
}

.scanner-camera__label {
    color: var(--muted, #6c757d);
    font-weight: 600;
    white-space: nowrap;
}

.scanner-camera__select {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 2.75rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-size: 0.9rem;
}

.scanner-cancel {
    flex: 0 0 auto;
    min-height: 2.75rem;
}

/*
  Fotoaufnahme: Dialog und Livebild skalieren ueber vw/dvh/px (nicht rem),
  damit Gross/XL das Kamerabild niemals verkleinern.
  Scan-Dialog (.scanner-dialog ohne --photo) bleibt kompakt.
*/
.scanner-overlay--photo {
    padding: 0.5rem;
}

.scanner-dialog--photo {
    /* Videobreite: Viewport-basiert, monoton Normal < Gross < XL */
    --photo-video-w: min(56vw, 760px);
    --photo-video-max-h: 56dvh;
    width: min(75vw, 960px);
    max-width: min(75vw, 960px);
    max-height: min(90dvh, calc(100dvh - 1rem));
    gap: 0.35rem;
    padding: 0.65rem 0.75rem;
    overflow: auto;
}

html.font-size-large .scanner-dialog--photo {
    --photo-video-w: min(66vw, 920px);
    --photo-video-max-h: 62dvh;
    width: min(84vw, 1160px);
    max-width: min(84vw, 1160px);
    max-height: min(94dvh, calc(100dvh - 0.75rem));
    gap: 0.3rem;
    padding: 0.55rem 0.7rem;
}

html.font-size-xlarge .scanner-dialog--photo {
    --photo-video-w: min(74vw, 1080px);
    --photo-video-max-h: 66dvh;
    width: min(92vw, 1360px);
    max-width: min(92vw, 1360px);
    max-height: min(96dvh, calc(100dvh - 0.5rem));
    gap: 0.28rem;
    padding: 0.5rem 0.65rem;
}

.scanner-dialog--photo .scanner-dialog__head {
    margin: 0;
    flex: 0 0 auto;
}

.scanner-dialog--photo .scanner-hint {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.2;
    flex: 0 0 auto;
}

.scanner-dialog--photo .scanner-error {
    margin: 0;
    padding: 0.4rem 0.6rem;
    flex: 0 0 auto;
}

/*
  Breite primaer ueber --photo-video-w (vw/px).
  Bei knapper Hoehe zusaetzlich auf max-h * 4/3 begrenzen — ohne rem.
*/
.scanner-dialog--photo .scanner-video-wrap {
    flex: 1 1 auto;
    flex-shrink: 0;
    width: min(100%, var(--photo-video-w), calc(var(--photo-video-max-h) * 4 / 3));
    max-width: 100%;
    height: auto;
    max-height: var(--photo-video-max-h);
    aspect-ratio: 4 / 3;
    margin-inline: auto;
    margin-block: 0;
    align-self: center;
}

.scanner-dialog--photo .scanner-video {
    object-fit: contain;
}

.scanner-photo-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.scanner-photo-preview[hidden] {
    display: none;
}

.scanner-controls--photo {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    margin-top: 0;
    flex: 0 0 auto;
}

.scanner-dialog--photo .scanner-camera {
    flex: 0 0 auto;
    width: 100%;
}

.scanner-photo-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: stretch;
    gap: 0.45rem;
}

.scanner-photo-actions[hidden] {
    display: none;
}

.scanner-photo-actions .btn-action {
    flex: 1 1 0;
    min-width: 8rem;
    justify-content: center;
}

/*
  Surface-/kurze Viewports + XL: Videohöhe und Abstände moderat drosseln,
  damit kein Scrollbalken entsteht. Hoehere Displays behalten XL unveraendert.
*/
@media (max-height: 800px) {
    html.font-size-xlarge .scanner-overlay--photo,
    body.font-size-xlarge .scanner-overlay--photo {
        padding: 0.35rem;
    }

    html.font-size-xlarge .scanner-dialog--photo,
    body.font-size-xlarge .scanner-dialog--photo {
        --photo-video-max-h: 56dvh;
        --photo-video-w: min(70vw, 1000px);
        max-height: min(95dvh, calc(100dvh - 0.5rem));
        gap: 0.2rem;
        padding: 0.4rem 0.55rem;
    }

    html.font-size-xlarge .scanner-dialog--photo .scanner-hint,
    body.font-size-xlarge .scanner-dialog--photo .scanner-hint {
        line-height: 1.15;
    }

    html.font-size-xlarge .scanner-dialog--photo .scanner-controls--photo,
    body.font-size-xlarge .scanner-dialog--photo .scanner-controls--photo {
        gap: 0.25rem;
    }

    html.font-size-xlarge .scanner-photo-actions,
    body.font-size-xlarge .scanner-photo-actions {
        gap: 0.35rem;
    }
}

@media (max-width: 576px) {
    .scanner-overlay {
        padding: 0.5rem;
    }

    .scanner-dialog {
        --scanner-chrome: 13.5rem;
        max-height: min(94dvh, calc(100dvh - 1rem));
    }

    .scanner-video-wrap {
        aspect-ratio: 3 / 4;
        width: min(100%, calc((100dvh - var(--scanner-chrome, 13.5rem)) * 3 / 4));
        max-height: min(58dvh, calc(100dvh - var(--scanner-chrome, 13.5rem)));
        min-height: 14rem;
    }

    .scanner-overlay--photo {
        padding: 0.35rem;
    }

    .scanner-dialog--photo {
        --photo-video-w: min(92vw, 100%);
        --photo-video-max-h: 58dvh;
        width: min(96vw, 100%);
        max-width: min(96vw, 100%);
        max-height: min(94dvh, calc(100dvh - 0.75rem));
        gap: 0.3rem;
        padding: 0.55rem;
    }

    html.font-size-large .scanner-dialog--photo {
        --photo-video-w: min(94vw, 100%);
        --photo-video-max-h: 60dvh;
    }

    html.font-size-xlarge .scanner-dialog--photo {
        --photo-video-w: min(96vw, 100%);
        --photo-video-max-h: 62dvh;
    }

    .scanner-dialog--photo .scanner-video-wrap {
        aspect-ratio: 3 / 4;
        width: min(100%, var(--photo-video-w), calc(var(--photo-video-max-h) * 3 / 4));
        max-height: var(--photo-video-max-h);
    }

    .scanner-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .scanner-cancel {
        width: 100%;
        justify-content: center;
    }

    .scanner-photo-actions .btn-action {
        width: 100%;
        min-width: 0;
    }
}

/* Vorgangsseite ------------------------------------------------------- */

.vorgang-head {
    margin: 0 0 0.55rem;
    padding: 0 0 0.55rem;
    border-bottom: 1px solid #dee2e6;
}

.vorgang-head__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem 0.75rem;
    width: 100%;
}

.vorgang-head__lead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.55rem;
    flex: 1 1 auto;
    min-width: 0;
}

.vorgang-head__home {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0.4rem 0.55rem;
    min-height: 2.4rem;
    border: 1px solid #343a40;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #6c757d 0%, #495057 45%, #343a40 100%);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(33, 37, 41, 0.28);
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.vorgang-head__home .bi {
    font-size: 1.15rem;
    line-height: 1;
    color: #fff;
}

.vorgang-head__home:hover,
.vorgang-head__home:focus-visible {
    border-color: #212529;
    background: linear-gradient(180deg, #868e96 0%, #495057 40%, #212529 100%);
    color: #fff;
    text-decoration: none;
}

.vorgang-head__home:focus-visible {
    outline: 2px solid #495057;
    outline-offset: 2px;
}

.vorgang-title {
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    word-break: break-word;
}

.badge--scan-id {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm, 0.25rem);
    background: #e9ecef;
    color: #495057;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.25;
    white-space: nowrap;
}

.works__title-row .badge--scan-id {
    align-self: center;
}

/* Rechtsbündig über dem Aktualisieren-Button in der Tab-Leiste */
.badge--active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    flex: 0 0 auto;
    margin-left: auto;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #d1e7dd;
    color: #0f5132;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.vorgang-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.85rem;
    margin: 0 0 0.85rem;
    padding: 0 0 0.55rem;
    border-bottom: 1px solid #dee2e6;
}

.vorgang-tabs__list {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
}

.vorgang-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.75rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: #212529;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.vorgang-tab .bi {
    font-size: 1.05rem;
    line-height: 1;
    flex: 0 0 auto;
}

/* Tabs mit farbigem SVG + Beschriftung: grauer Verlauf statt Primärblau */
.vorgang-tab--icon {
    border-color: #ced4da;
    background: linear-gradient(180deg, #ffffff 0%, #f1f3f5 55%, #e9ecef 100%);
    color: #343a40;
    box-shadow: none;
}

.vorgang-tab--icon .bi {
    font-size: 1.1rem;
}

.vorgang-tab--auftrag .bi {
    color: #3d8bfd;
}

.vorgang-tab--positionen .bi {
    color: #14b8a6;
}

.vorgang-tab--medien .bi {
    color: #f97316;
}

.vorgang-tab--kommunikation .bi {
    color: #38bdf8;
}

.vorgang-tab--mdr .bi {
    color: #eab308;
}

.vorgang-tab--hinweise .bi {
    color: #f59e0b;
}

.hinweise-badge {
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    margin-left: 0.15rem;
    border-radius: 999px;
    background: #f59e0b;
    color: #212529;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
}

/* display erst ohne [hidden], sonst bleibt ein leerer oranger Kreis sichtbar */
.hinweise-badge:not([hidden]) {
    display: inline-flex;
}

.hinweise-badge[hidden] {
    display: none !important;
}

.vorgang-tab--hinweise.vorgang-tab--active .hinweise-badge {
    background: #d97706;
    color: #fff;
}

.vorgang-tab--active {
    background: var(--brand, #0d6efd);
    border-color: var(--brand, #0d6efd);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(13, 110, 253, 0.25);
}

/* Aktiv: grauer Verlauf, Text dunkel, SVG-Farbe bleibt */
.vorgang-tab--icon.vorgang-tab--active {
    border-color: #adb5bd;
    background: linear-gradient(180deg, #f1f3f5 0%, #e9ecef 45%, #ced4da 100%);
    color: #212529;
    font-weight: 700;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.vorgang-tab--disabled {
    cursor: not-allowed;
    opacity: 0.85;
    pointer-events: none;
}

.vorgang-tab--icon.vorgang-tab--disabled {
    border-color: #dee2e6;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    color: #6c757d;
    opacity: 0.9;
}

.vorgang-tab--icon.vorgang-tab--disabled .bi {
    opacity: 0.75;
}

.vorgang-panel--overview {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.vorgang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    gap: 0.75rem;
}

.vorgang-grid--overview {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    align-items: start;
    gap: 0.55rem;
}

@media (min-width: 900px) {
    .vorgang-grid--overview {
        grid-template-columns: 1.1fr 1fr;
    }
}

.vorgang-panel--info {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.vorgang-tab--info .bi {
    color: #0ea5e9;
}

.vorgang-card--termine {
    margin-top: 0;
}

/* Terminbereich: Bootstrap-Grid-Aequivalent (kein globales Bootstrap-CSS).
   col-12 unter xl, ab xl (1200px) max. 50 % linksbuendig. */
.vorgang-panel--overview > .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
}

.vorgang-panel--overview > .row > .col-12 {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    padding: 0;
}

@media (min-width: 1200px) {
    .vorgang-panel--overview > .row > .col-xl-6 {
        width: 50%;
        max-width: 50%;
    }
}

.termine-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border);
}

.termine-item {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.termine-item__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
}

.termine-item__main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.55rem;
    min-width: 0;
    flex: 1 1 12rem;
}

.termine-item__when {
    font-weight: 700;
    color: #212529;
    white-space: nowrap;
    font-size: 0.92rem;
}

.termine-item__title {
    font-weight: 500;
    color: #343a40;
    word-break: break-word;
    font-size: 0.92rem;
}

.termine-item__flags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem 0.35rem;
    flex: 0 1 auto;
    margin-left: auto;
}

.termine-item__art,
.termine-item__status {
    display: inline-block;
    padding: 0.08rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
}

.termine-item__art {
    background: #e9ecef;
    color: #495057;
}

.termine-item__status--offen {
    background: #e7f1ff;
    color: #0b5ed7;
}

.termine-item__status--erledigt {
    background: #e8f5e9;
    color: #2e7d32;
}

.termine-item__status--storniert {
    background: #fdecea;
    color: #b02a37;
}

.termine-item--canceled .termine-item__main.tec-appointment--canceled .termine-item__when,
.termine-item--canceled .termine-item__main.tec-appointment--canceled .termine-item__title,
.termine-item__art.tec-appointment--canceled {
    color: #b02a37;
    text-decoration: line-through;
}

.termine-item__status--storniert {
    text-decoration: none;
}

.vorgang-card--history {
    margin-top: 0;
}

.history-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 2px solid #dee2e6;
    margin-left: 0.35rem;
}

.history-item {
    position: relative;
    padding: 0 0 0.85rem 0.9rem;
}

.history-item:last-child {
    padding-bottom: 0;
}

.history-item::before {
    content: "";
    position: absolute;
    left: -0.35rem;
    top: 0.35rem;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #0ea5e9;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #dee2e6;
}

.history-item__when {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #6c757d;
    letter-spacing: 0.01em;
}

.history-item__body {
    margin-top: 0.2rem;
}

.history-item__title {
    margin: 0;
    font-weight: 600;
    color: #212529;
    line-height: 1.35;
    word-break: break-word;
}

.history-item__detail {
    margin: 0.25rem 0 0;
    color: #495057;
    font-size: 0.92rem;
}

.history-item__transfer {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-top: 0.35rem;
}

@media (min-width: 700px) {
    .history-item__transfer {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 0.35rem 0.55rem;
    }
}

.history-item__transfer-label {
    flex: 0 0 auto;
    min-width: 2.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6c757d;
}

.history-item__transfer-value {
    color: #343a40;
    word-break: break-word;
}

.history-item__memo {
    margin: 0.4rem 0 0;
    padding: 0.4rem 0.55rem;
    border-left: 3px solid #ced4da;
    background: #f8f9fa;
    color: #495057;
    font-size: 0.9rem;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.vorgang-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.65rem 0.85rem;
    background: var(--surface);
}

.vorgang-card--schema {
    margin-top: 0;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.vorgang-card--order .result-meta,
.vorgang-card--kunde .kunde-block,
.vorgang-card--workstatus .result-meta {
    margin-bottom: 0;
}

.vorgang-card__title {
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.vorgang-card__subtitle {
    margin: 0 0 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6c757d;
}

.result-meta--order {
    margin: 0;
}

.result-meta--order .result-meta__row dt {
    color: #212529;
    font-weight: 700;
}

.result-meta--order .result-meta__row dd {
    font-weight: 400;
}

.result-meta__row--patient .patient-name {
    font-size: 1.08em;
    font-weight: 700;
    color: #212529;
}

.kunde-block {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.kunde-block__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
}

.kunde-block__name {
    margin: 0;
    font-weight: 700;
    font-size: 1.02em;
}

.kunde-block__sep {
    margin: 0.45rem 0;
    border: 0;
    border-top: 1px solid #dee2e6;
}

.kunde-block__addr {
    margin: 0;
    font-style: normal;
    line-height: 1.35;
    color: #343a40;
}

.kunde-block__addr-line {
    display: block;
}

.kunde-block__behandler {
    margin: 0.55rem 0 0;
    color: #212529;
    font-weight: 400;
}

.kunde-block__behandler-label {
    font-weight: 700;
}

.workstatus-cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

@media (min-width: 700px) {
    .workstatus-cols {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem 1.25rem;
        align-items: start;
    }
}

.workstatus-cols__col .result-meta {
    margin: 0;
}

.kunde-with-contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.65rem;
}

.btn-contact {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    border: 1px solid #adb5bd;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: #212529;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-contact:hover {
    background: #e7f1ff;
    border-color: #0d6efd;
}

.btn-contact:focus-visible {
    outline: 2px solid rgba(13, 110, 253, 0.45);
    outline-offset: 2px;
}

.vorgang-empty--inline {
    border-style: none;
    padding: 0.25rem 0;
}

/* Zahnschema (Anzeige, angelehnt an Kundenportal-FDI) */
.tec-zahnschema {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tec-zahnschema__jaw {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.tec-zahnschema__jaw-label {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6c757d;
    text-align: center;
    line-height: 1.2;
}

.tec-zahnschema__row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: fit-content;
    gap: 0.2rem;
}

.tec-zahnschema__quad {
    display: flex;
    flex: 0 0 auto;
    gap: 2px;
}

.tec-zahnschema__mid {
    flex: 0 0 2px;
    width: 2px;
    background: #1f4e79;
    align-self: stretch;
}

.tec-tooth {
    flex: 0 0 auto;
    width: 2.35rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    text-align: center;
    padding: 0.15rem 0.05rem;
    background: var(--surface);
    line-height: 1.1;
    box-sizing: border-box;
}

.tec-tooth.has-abbr {
    border-color: #1f4e79;
    background: #eef3f8;
}

.tec-tooth__num {
    display: block;
    font-size: 0.55rem;
    color: #6c757d;
}

.tec-tooth__abbr {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    min-height: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Kontaktdaten-Dialog */
body.contact-dialog-open {
    overflow: hidden;
}

.contact-dialog {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.contact-dialog[hidden] {
    display: none !important;
}

.contact-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(33, 37, 41, 0.45);
}

.contact-dialog__panel {
    position: relative;
    z-index: 1;
    width: min(28rem, 100%);
    max-height: min(85vh, 36rem);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.contact-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #dee2e6;
}

.contact-dialog__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
}

.contact-dialog__close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    padding: 0.1rem 0.35rem;
}

.contact-dialog__body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 0.85rem 1rem;
}

.contact-dialog__kunde {
    margin: 0 0 0.75rem;
}

.contact-dialog__kndnr {
    color: #6c757d;
    font-weight: 500;
}

.contact-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

.contact-dialog__footer .btn-secondary {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid #adb5bd;
    background: var(--surface);
    color: #343a40;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.booking-badge--self {
    background: #cfe2ff;
    color: #084298;
    font-weight: 600;
}

a.vorgang-tab:not(.vorgang-tab--icon) {
    color: #212529;
    background: var(--surface);
    cursor: pointer;
}

a.vorgang-tab:not(.vorgang-tab--icon):hover {
    background: #e7f1ff;
    border-color: #9ec5fe;
    color: #084298;
}

a.vorgang-tab:not(.vorgang-tab--icon):focus-visible {
    outline: 2px solid var(--brand, #0d6efd);
    outline-offset: 2px;
    background: #e7f1ff;
    border-color: var(--brand, #0d6efd);
    color: #084298;
}

a.vorgang-tab--icon {
    cursor: pointer;
}

a.vorgang-tab--icon:hover {
    border-color: #adb5bd;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
    text-decoration: none;
}

a.vorgang-tab--icon:focus-visible {
    outline: 2px solid #868e96;
    outline-offset: 2px;
}

a.vorgang-tab--icon.vorgang-tab--active:hover {
    border-color: #adb5bd;
    background: linear-gradient(180deg, #e9ecef 0%, #dee2e6 55%, #ced4da 100%);
}

.vorgang-tab--active:focus-visible {
    outline: 2px solid #084298;
    outline-offset: 2px;
}

.vorgang-empty {
    margin: 0;
    padding: 0.75rem 0.9rem;
    border: 1px dashed var(--border-input);
    border-radius: var(--radius-lg);
    color: var(--text-muted, #6c757d);
    font-size: 0.92rem;
}

.pos-item__muted {
    font-weight: 400;
    color: var(--text-muted, #6c757d);
}

/* Statusleiste (Lockhinweis) oberhalb der Positionen */
.pos-statusbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.pos-lock {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 16rem;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.35;
}

.pos-lock i {
    flex: 0 0 auto;
}

.pos-lock--locked {
    border-color: #f0c36d;
    background: #fff6e0;
    color: #7a5600;
}

.pos-lock--unknown {
    border-color: var(--border-input);
    background: var(--surface-hover);
    color: var(--text-muted, #495057);
}

.btn-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-left: 0.35rem;
    width: 2.75rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0;
    border: 1px solid #ced4da;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #ffffff 0%, #f1f3f5 55%, #e9ecef 100%);
    color: #c2410c;
    font-size: 1.15rem;
    text-decoration: none;
    align-self: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-refresh .bi {
    line-height: 1;
    color: #c2410c;
}

.btn-refresh:hover,
.btn-refresh:focus {
    border-color: #adb5bd;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
    color: #c2410c;
    text-decoration: none;
}

.btn-refresh:focus-visible {
    outline: 2px solid #c2410c;
    outline-offset: 2px;
}

.btn-refresh--busy {
    pointer-events: none;
    opacity: 0.75;
}

.btn-refresh--busy .bi {
    animation: btn-refresh-spin 0.8s linear infinite;
}

@keyframes btn-refresh-spin {
    to { transform: rotate(360deg); }
}

/* Lade-Overlay ueber dem Portal-Inhaltsbereich (Header bleibt frei) */
.portal-main {
    position: relative;
}

.page-loading {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(244, 246, 249, 0.72);
    backdrop-filter: blur(1px);
    pointer-events: all;
}

.page-loading[hidden] {
    display: none !important;
}

.page-loading__panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 1.35rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-width: 18rem;
    text-align: center;
}

.page-loading__text {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: #343a40;
}

/* Bootstrap-aehnlicher Spinner (ohne volles Bootstrap-CSS) */
.spinner-border {
    display: inline-block;
    width: 1.75rem;
    height: 1.75rem;
    vertical-align: text-bottom;
    border: 0.2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: page-spinner 0.75s linear infinite;
}

.spinner-border.text-primary {
    color: #0d6efd;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

@keyframes page-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Positions-Tabelle (kompakt, 10-13 Zoll) */
.pos-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.pos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    background: var(--surface);
}

.pos-table th,
.pos-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #eef0f2;
    text-align: left;
    vertical-align: top;
}

.pos-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-hover);
    font-size: 0.8rem;
    white-space: nowrap;
}

.pos-table tbody tr:last-child td {
    border-bottom: none;
}

.pos-col-lm,
.pos-col-qty,
.pos-col-te,
.pos-col-split {
    width: 1%;
    white-space: nowrap;
}

.pos-col-qty,
.pos-col-te {
    text-align: right;
}

.pos-col-qty {
    font-weight: 600;
    white-space: nowrap;
}

.pos-col-desc {
    min-width: 12rem;
    width: 100%;
    word-break: break-word;
}

.pos-col-list,
.pos-col-art {
    white-space: nowrap;
}

.pos-dash {
    color: var(--text-muted, #adb5bd);
}

.btn-split {
    padding: 0.2rem 0.65rem;
    border: 1px solid #adb5bd;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: #495057;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-split:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #9aa5b1;
}

.btn-split:disabled {
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-te {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 1.75rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid #b8c2cc;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: #212529;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-te:hover:not(:disabled) {
    background: #e7f1ff;
    border-color: #0d6efd;
}

.btn-te--own {
    background: #e8f5e9;
    border-color: #81c784;
    color: #1b5e20;
}

.btn-te--foreign {
    background: #f8f9fa;
    color: #6c757d;
    cursor: default;
}

.btn-te:disabled {
    opacity: 0.55;
    cursor: wait;
}

/* Vorschau bearbeitbarer Zellen (noch kein echtes Eingabefeld) */
.editable-preview {
    display: inline-flex;
    align-items: center;
    min-width: 2.5rem;
    min-height: 1.75rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid #b8c2cc;
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.editable-preview--qty {
    justify-content: flex-end;
}

.pos-ajax-msg {
    margin: 0.5rem 0 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
}

.pos-ajax-msg--ok {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #c8e6c9;
}

.pos-ajax-msg--err {
    background: #fdecea;
    color: #7f1d1d;
    border: 1px solid #f5c2c7;
}

.pos-ajax-msg--info {
    background: #e7f1ff;
    color: #084298;
    border: 1px solid #b6d4fe;
}

/* Kompakte Mengengruppe: [ - ] [ 2,45 ] [ + ] — Zeilenhöhe ~32–36px */
.pos-qty-edit {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.2rem;
    vertical-align: middle;
    white-space: nowrap;
    max-width: 100%;
}

.pos-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid #b8c2cc;
    border-radius: var(--radius-sm);
    background: #f8f9fa;
    color: #212529;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

.pos-qty-btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #9aa5b1;
}

.pos-qty-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.pos-qty-input {
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 3.4rem;
    min-width: 3.4rem;
    max-width: 3.75rem;
    height: 2rem;
    padding: 0 0.3rem;
    border: 1px solid #b8c2cc;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: #212529;
    text-align: right;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
}

.pos-qty-input:focus {
    outline: 2px solid rgba(13, 110, 253, 0.35);
    border-color: #0d6efd;
}

.pos-qty-input:disabled {
    opacity: 0.65;
    background: #f8f9fa;
}

/* Temporaerer Status — kein Layout-Shift der Tabelle */
.pos-qty-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin-left: 0.1rem;
    font-size: 0.85rem;
    line-height: 1;
    color: #6c757d;
}

.pos-qty-status[hidden] {
    display: none !important;
}

.pos-qty-status.is-ok {
    color: #198754;
}

.pos-qty-status.is-err {
    color: #dc3545;
}

.editable-preview--te {
    justify-content: center;
    min-width: 2.75rem;
}

.pos-split-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--surface-hover);
    color: var(--text-muted, #495057);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.pos-split-badge--btn {
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.pos-split-badge--btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
}

.pos-split-badge--btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Split-Dialog */
body.split-dialog-open {
    overflow: hidden;
}

.split-dialog {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.split-dialog[hidden] {
    display: none !important;
}

.split-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(33, 37, 41, 0.45);
}

.split-dialog__panel {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: min(90vh, 720px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.split-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #dee2e6;
}

.split-dialog__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 650;
}

.split-dialog__close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    padding: 0.1rem 0.35rem;
}

.split-dialog__hint {
    margin: 0.65rem 1rem 0;
    font-size: 0.85rem;
    color: #084298;
}

.split-dialog__msg {
    margin: 0.65rem 1rem 0;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.split-dialog__msg--ok {
    background: #e8f5e9;
    color: #1b5e20;
}

.split-dialog__msg--err {
    background: #fdecea;
    color: #7f1d1d;
}

.split-dialog__msg--info {
    background: #e7f1ff;
    color: #084298;
}

.split-dialog__table-wrap {
    flex: 1 1 auto;
    overflow: auto;
    padding: 0.75rem 1rem;
}

.split-dialog__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.split-dialog__table th,
.split-dialog__table td {
    padding: 0.35rem 0.3rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    text-align: left;
}

.split-col-share {
    width: 8.5rem;
    text-align: center;
}

.split-col-actions {
    width: 2.2rem;
    text-align: center;
}

.split-te-select,
.split-label-input,
.split-share-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 2rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid #b8c2cc;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.88rem;
    background: var(--surface);
}

.split-share-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.split-share-input {
    width: 3.4rem;
    text-align: right;
    font-weight: 600;
}

.split-share-btn,
.split-row-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid #b8c2cc;
    border-radius: var(--radius-sm);
    background: #f8f9fa;
    color: #212529;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.split-share-btn:hover,
.split-row-del:hover {
    background: #e9ecef;
}

.split-dialog__sum-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.35rem 1rem 0.65rem;
    font-size: 0.95rem;
}

.split-dialog__sum-spacer {
    flex: 1 1 auto;
}

.split-dialog__remain {
    font-size: 0.88rem;
    font-weight: 500;
    color: #495057;
}

.split-dialog__remain.is-ok {
    color: #198754;
}

.split-dialog__remain.is-warn {
    color: #9a3412;
}

.split-dialog__remain.is-bad {
    color: #dc3545;
}

.split-dialog__remain[hidden] {
    display: none !important;
}

.split-dialog__sum-row .is-ok {
    color: #198754;
}

.split-dialog__sum-row .is-bad {
    color: #dc3545;
}

.split-dialog__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

.split-dialog__footer-spacer {
    flex: 1 1 auto;
    min-width: 0.5rem;
}

.split-dialog__footer .btn-primary,
.split-dialog__footer .btn-secondary {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.split-dialog__footer .btn-primary {
    border: 1px solid #0d6efd;
    background: #0d6efd;
    color: #fff;
}

.split-dialog__footer .btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.split-dialog__footer .btn-secondary {
    border: 1px solid #adb5bd;
    background: var(--surface);
    color: #343a40;
}

.split-dialog__footer .btn-secondary:hover:not(:disabled) {
    background: #e9ecef;
}

@media (hover: hover) {
    .editable-preview:hover {
        border-color: #8c98a4;
    }
}

.art-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--art-bg, #e9ecef);
    color: var(--art-fg, #212529);
    white-space: nowrap;
}

/* ----- Medien-Tab ------------------------------------------------------- */

.media-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.media-toolbar__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.media-toolbar__count {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: #e9ecef;
    color: #495057;
    font-size: 0.8rem;
    font-weight: 600;
}

.media-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
}

.media-toolbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.75rem;
    padding: 0.5rem 0.95rem;
    border: 1px solid #adb5bd;
    border-radius: var(--radius-md);
    background: var(--surface);
    color: #343a40;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.media-toolbar__btn .bi {
    font-size: 1.1rem;
    line-height: 1;
}

.media-toolbar__btn:hover:not(:disabled) {
    background: #e9ecef;
}

.media-toolbar__btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.media-upload-dialog__panel {
    width: min(32rem, calc(100vw - 1.5rem));
    max-height: min(90dvh, calc(100dvh - 1.5rem));
}

.media-upload-dialog__body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 0.95rem;
    overflow: auto;
}

.media-upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 10rem;
    max-height: 40dvh;
    background: #212529;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.media-upload-preview__img {
    display: block;
    max-width: 100%;
    max-height: 40dvh;
    object-fit: contain;
}

.media-upload-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #343a40;
}

.media-upload-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 2.5rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    font-size: 1rem;
}

.media-upload-status {
    margin: 0;
    color: #0d6efd;
    font-size: 0.9rem;
    font-weight: 600;
}

.media-upload-error {
    margin: 0;
    color: #b02a37;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Medienliste: 1 Spalte, ab Bootstrap-xl (1200px) zwei Spalten.
   Kein volles Bootstrap-CSS geladen — Layout hier als CSS-Grid. */
.media-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
}

@media (min-width: 1200px) {
    .media-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.media-item {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.media-item__main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
}

.media-item__main:hover,
.media-item__main:focus-visible {
    background: #f8f9fa;
}

.media-item__thumb {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-md);
    background: var(--surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-item__thumb-img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    display: block;
}

.media-item__thumb-icon {
    font-size: 1.75rem;
    color: #6c757d;
}

.media-item__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.media-item__name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.media-item__desc {
    font-size: 0.85rem;
    color: var(--muted, #6c757d);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.media-item__facts {
    font-size: 0.8rem;
    color: var(--muted, #6c757d);
}

.media-item__dl {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    color: #495057;
    text-decoration: none;
    border-left: 1px solid #edf0f2;
}

.media-item__dl:hover,
.media-item__dl:focus-visible {
    background: #e9ecef;
    color: #0d6efd;
}

.media-dialog {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    box-sizing: border-box;
}

.media-dialog[hidden] {
    display: none !important;
}

.media-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.media-dialog__panel {
    position: relative;
    z-index: 1;
    width: var(--media-dialog-width, min(960px, calc(100vw - 1.5rem)));
    max-width: 100%;
    height: var(--media-dialog-height, min(85dvh, calc(100dvh - 1.5rem)));
    max-height: var(--media-dialog-height, min(85dvh, calc(100dvh - 1.5rem)));
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    box-sizing: border-box;
}

.media-dialog__panel--stl,
.media-dialog__panel--pdf,
.media-dialog__panel--image {
    width: var(--media-dialog-width, min(960px, calc(100vw - 1.5rem)));
}

.media-dialog__header,
.media-dialog__footer {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 0 0 auto;
    padding: 0.7rem 0.9rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.media-dialog__footer {
    border-bottom: 0;
    border-top: 1px solid #dee2e6;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.media-viewer-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
}

.media-dialog__footer .btn-primary,
.media-dialog__footer .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: auto;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-sizing: border-box;
}

/* display:inline-flex darf HTML-hidden nicht überstimmen */
.media-dialog__footer .btn-primary[hidden],
.media-dialog__footer .btn-secondary[hidden] {
    display: none !important;
}

.media-dialog__footer .btn-primary .bi,
.media-dialog__footer .btn-secondary .bi {
    font-size: 1.1rem;
    line-height: 1;
}

.media-dialog__footer .btn-primary {
    border: 1px solid var(--brand, #0d6efd);
    background: var(--brand, #0d6efd);
    color: #fff;
}

.media-dialog__footer .btn-primary:hover {
    background: var(--brand-dark, #0b5ed7);
    border-color: var(--brand-dark, #0b5ed7);
    color: #fff;
}

.media-dialog__footer .btn-secondary {
    border: 1px solid #adb5bd;
    background: var(--surface);
    color: #343a40;
}

.media-dialog__footer .btn-secondary:hover {
    background: #e9ecef;
    color: #343a40;
}

.media-dialog__title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-dialog__close {
    border: 0;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #495057;
    padding: 0.1rem 0.35rem;
}

.media-dialog__body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
    background: #f4f6f9;
}

.media-dialog__loading,
.media-dialog__error {
    margin: 0;
    flex: 0 0 auto;
    font-size: 0.9rem;
}

.media-dialog__error {
    color: #842029;
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    border-radius: var(--radius-md);
    padding: 0.55rem 0.7rem;
}

.media-dialog__stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

.media-preview-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: auto;
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.media-preview-pdf {
    display: block;
    width: 100%;
    height: 100%;
    flex: 1 1 auto;
    min-height: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.media-stl-canvas {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #f0f0f0;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.media-stl-canvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

html.media-dialog-open,
html.media-dialog-open body {
    overflow: hidden;
}

@media (max-width: 640px) {
    .media-item__thumb {
        flex-basis: 56px;
        width: 56px;
        height: 56px;
    }

    .media-item__thumb-img {
        width: 56px;
        height: 56px;
    }

    .media-dialog {
        padding: 0;
    }

    html.font-size-normal,
    html.font-size-large,
    html.font-size-xlarge,
    body.font-size-normal,
    body.font-size-large,
    body.font-size-xlarge {
        --media-dialog-width: 100vw;
        --media-dialog-height: 100dvh;
    }

    .media-dialog__panel {
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        max-height: 100dvh;
        border-radius: 0;
    }
}

/* --- MDR / Chargen --- */

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.mdr-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}

.mdr-toolbar__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
}

.mdr-toolbar__count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted, #6c757d);
}

/* Gleiche Scanleiste wie Dashboard (.action-bar / .action-search) */
.mdr-action-bar {
    margin-bottom: 0.55rem;
    flex-wrap: wrap;
    row-gap: 0.45rem;
}

.mdr-action-bar .btn-action--manual {
    background: var(--surface-hover);
    color: #343a40;
    border: 1px solid var(--border);
    font-weight: 600;
    min-height: 2.75rem;
    white-space: normal;
    line-height: 1.2;
    text-align: center;
}

.mdr-action-bar .btn-action--manual:hover:not(:disabled) {
    background: #e9ecef;
}

.mdr-action-bar .btn-action--manual:disabled {
    opacity: 0.55;
}

.mdr-manual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 0.65rem;
}

@media (max-width: 699px) {
    .mdr-manual-grid {
        grid-template-columns: 1fr;
    }
}

.mdr-field-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 0.35rem 0.55rem;
}

.mdr-field-pair__field {
    min-width: 0;
}

.mdr-field-pair-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: end;
    min-height: 2.75rem;
    padding: 0 0.1rem 0.1rem;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--muted, #6c757d);
    white-space: nowrap;
    user-select: none;
}

@media (max-width: 699px) {
    .mdr-field-pair {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 0.3rem;
    }

    .mdr-field-pair-separator {
        min-height: 0;
        padding: 0.1rem 0;
        justify-content: flex-start;
    }
}

.mdr-field-group-hint {
    margin: 0 0 0.3rem;
    font-size: 0.82rem;
    color: var(--muted, #6c757d);
}

.mdr-field-group-error {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #b02a37;
}

.mdr-field-group-error[hidden] {
    display: none !important;
}

.mdr-manual-mfg-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.4rem;
    margin: 0.15rem 0 0.25rem;
}

.mdr-manual-mfg-row__input {
    flex: 1 1 12rem;
    min-width: 0;
    min-height: 2.75rem;
}

.mdr-manual-mfg-row__btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

@media (max-width: 699px) {
    .mdr-manual-mfg-row__btn {
        flex: 1 1 100%;
        width: 100%;
    }
}

.mdr-manual-mfg-create {
    margin-top: 0.25rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8f9fa;
}

.mdr-manual-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-top: 0.4rem;
}

/* Body-Buttons wie Footer-Buttons stylen (Klassen sonst nur im Footer definiert) */
.mdr-dialog--manual .btn-primary,
.mdr-dialog--manual .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: auto;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-sizing: border-box;
}

.mdr-dialog--manual .btn-primary .bi,
.mdr-dialog--manual .btn-secondary .bi {
    font-size: 1.1rem;
    line-height: 1;
}

.mdr-dialog--manual .btn-primary {
    border: 1px solid var(--brand, #0d6efd);
    background: var(--brand, #0d6efd);
    color: #fff;
}

.mdr-dialog--manual .btn-primary:hover:not(:disabled) {
    background: var(--brand-dark, #0b5ed7);
    border-color: var(--brand-dark, #0b5ed7);
    color: #fff;
}

.mdr-dialog--manual .btn-secondary {
    border: 1px solid #adb5bd;
    background: var(--surface);
    color: #343a40;
}

.mdr-dialog--manual .btn-secondary:hover:not(:disabled) {
    background: #e9ecef;
    color: #343a40;
}

.mdr-dialog--manual .btn-primary:disabled,
.mdr-dialog--manual .btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.mdr-dialog--manual .mdr-manual-inline-actions .btn-primary,
.mdr-dialog--manual .mdr-manual-inline-actions .btn-secondary {
    flex: 0 1 auto;
    min-width: 8.5rem;
}

.mdr-dialog--manual.mdr-dialog--compact .media-dialog__body,
.mdr-dialog--manual .media-dialog__body {
    max-height: min(70vh, 36rem);
    overflow-y: auto;
    padding: 0.4rem 0.8rem 0.55rem;
    gap: 0;
}

.mdr-dialog--manual .mdr-manual-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mdr-dialog--manual .mdr-assign-block {
    margin-top: 0;
    padding-top: 0;
}

.mdr-dialog--manual .mdr-assign-block--manual-first,
.mdr-dialog--manual .mdr-assign-block:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.mdr-dialog--manual .mdr-manual-field-row {
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px solid #edf0f2;
}

.mdr-dialog--manual .mdr-field {
    margin-bottom: 0;
}

.mdr-dialog--manual .mdr-manual-grid .mdr-field,
.mdr-dialog--manual .mdr-field-pair .mdr-field {
    margin-bottom: 0;
}

.mdr-dialog--manual .mdr-manual-mfg-chosen {
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0.3rem;
    border-top: none;
}

.mdr-dialog--manual .mdr-manual-mfg-chosen .mdr-field__label,
.mdr-dialog--manual .mdr-manual-mat-chosen .mdr-field__label {
    display: block;
    margin-bottom: 0.1rem;
}

.mdr-dialog--manual .mdr-manual-mfg-chosen__name,
.mdr-dialog--manual .mdr-manual-mat-chosen__name {
    display: block;
    font-size: 0.98rem;
    font-weight: 600;
    color: #212529;
    line-height: 1.25;
    word-break: break-word;
}

.mdr-dialog--manual .mdr-manual-mat-chosen {
    margin: 0;
    padding: 0;
}

.mdr-dialog--manual .mdr-manual-mat-chosen__meta {
    margin: 0.15rem 0 0;
    font-size: 0.82rem;
    font-weight: 500;
    color: #5c6b7a;
    line-height: 1.3;
}

.mdr-dialog--manual #mdrManualMatBlock {
    margin-top: 0.15rem;
    padding-top: 0.4rem;
    border-top: 1px solid #edf0f2;
}

.mdr-dialog--manual .mdr-manual-mat-hit {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-height: 2.75rem;
    text-align: left;
}

.mdr-dialog--manual .mdr-manual-mat-hit__meta {
    font-size: 0.8rem;
    font-weight: 500;
    color: #5c6b7a;
}

.mdr-dialog--manual .mdr-manual-mat-hit__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.1rem;
}

.mdr-dialog--manual .mdr-manual-badge {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.mdr-dialog--manual .mdr-manual-badge--oberbegriff {
    background: #fff3cd;
    color: #664d03;
}

.mdr-dialog--manual .mdr-manual-badge--sammelkonto {
    background: #e2e3e5;
    color: #41464b;
}

.mdr-dialog--manual .mdr-manual-mat-facts {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.mdr-dialog--manual .mdr-manual-mat-facts__row {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 0.35rem;
    align-items: baseline;
}

.mdr-dialog--manual .mdr-manual-mat-facts__row dt {
    margin: 0;
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 600;
}

.mdr-dialog--manual .mdr-manual-mat-facts__row dd {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
}

.mdr-dialog--manual .mdr-manual-hint {
    margin: 0;
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius-sm);
    background: #fff8e6;
    color: #664d03;
    font-size: 0.86rem;
    line-height: 1.35;
}

.btn-secondary--small {
    font-size: 0.88rem;
    padding: 0.35rem 0.65rem;
    min-height: 2.25rem;
}

.mdr-scanbar__status {
    margin: 0 0 0.45rem;
    font-size: 0.9rem;
    color: var(--muted, #6c757d);
}

.mdr-scanbar__error {
    margin: 0 0 0.45rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #b02a37;
}

.mdr-flash {
    margin: 0 0 0.55rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid transparent;
    line-height: 1.3;
}

.mdr-flash[hidden] {
    display: none !important;
}

.mdr-flash--success {
    background: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

.mdr-flash--notice {
    background: #fff3cd;
    border-color: #ffecb5;
    color: #664d03;
}

.mdr-flash--error {
    background: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

html.font-size-large .mdr-flash,
body.font-size-large .mdr-flash {
    font-size: 1.02rem;
}

html.font-size-xlarge .mdr-flash,
body.font-size-xlarge .mdr-flash {
    font-size: 1.1rem;
}

.mdr-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.mdr-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
}

.mdr-table th,
.mdr-table td {
    padding: 0.45rem 0.5rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mdr-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--muted, #6c757d);
    font-weight: 700;
    white-space: nowrap;
}

.mdr-table__col-action {
    width: 7rem;
}

.mdr-row--inactive {
    opacity: 0.8;
}

.mdr-cell--scan {
    font-weight: 700;
    white-space: nowrap;
}

.mdr-cell--ref {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    font-weight: 700;
}

.mdr-cell--mat,
.mdr-cell--mfg {
    word-break: break-word;
    min-width: 6rem;
}

.mdr-cell--code {
    white-space: nowrap;
    vertical-align: middle;
}

.mdr-cell--dates {
    white-space: nowrap;
    vertical-align: top;
}

.mdr-date-stack {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    line-height: 1.25;
    font-size: 0.9rem;
}

.mdr-date-label {
    display: inline-block;
    min-width: 2.6rem;
    color: var(--muted, #6c757d);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    margin-right: 0.2rem;
}

.mdr-badge {
    display: inline-block;
    padding: 0.05rem 0.3rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.2;
    margin-right: 0.2rem;
    vertical-align: middle;
    background: #e9ecef;
    color: #343a40;
}

.mdr-badge--code {
    letter-spacing: 0.02em;
}

.mdr-badge--hibc {
    background: #cff4fc;
    color: #055160;
}

.mdr-badge--gs1 {
    background: #d1e7dd;
    color: #0f5132;
}

.mdr-badge--manual,
.mdr-badge--scan_id {
    background: #e9ecef;
    color: #495057;
}

.mdr-badge--inactive {
    background: #e9ecef;
    color: #495057;
}

/* MHD-Warnung nur in Erfassungsdialogen */
.mdr-fact--expired dd {
    color: #b02a37;
    font-weight: 700;
}

.mdr-expiry-hint {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #b02a37;
}

.mdr-btn-remove {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
}

/* Kompakte MDR-Dialoge: Höhe am Inhalt, nicht am Viewport */
.mdr-dialog--compact .mdr-dialog__panel--compact,
.mdr-dialog .mdr-dialog__panel--compact {
    width: min(700px, calc(100vw - 1.5rem));
    height: auto;
    max-height: min(90dvh, calc(100dvh - 1.5rem));
    min-height: 0;
}

html.font-size-large .mdr-dialog--compact .mdr-dialog__panel--compact,
body.font-size-large .mdr-dialog--compact .mdr-dialog__panel--compact {
    width: min(760px, calc(100vw - 1.25rem));
}

html.font-size-xlarge .mdr-dialog--compact .mdr-dialog__panel--compact,
body.font-size-xlarge .mdr-dialog--compact .mdr-dialog__panel--compact {
    width: min(820px, calc(100vw - 1rem));
}

.mdr-dialog--compact .media-dialog__body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 0.85rem 1rem 1rem;
}

.mdr-dialog__title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.mdr-dialog__title-icon {
    flex: 0 0 auto;
    font-size: 1.25em;
    color: var(--bs-primary, #0d6efd);
}

.mdr-dialog__title-icon--warn {
    color: #b78103;
}

.mdr-btn--warn-accept {
    background: #dd9f0c !important;
    border-color: #b78103 !important;
    color: #212529 !important;
}

.mdr-btn--warn-accept:hover {
    background: #c7910a !important;
    border-color: #9a6d02 !important;
    color: #212529 !important;
}

.mdr-dialog__lead {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    line-height: 1.35;
    color: var(--text, #212529);
}

.mdr-item__facts,
.mdr-dialog__facts {
    margin: 0 0 0.9rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem 1rem;
}

.mdr-fact {
    min-width: 0;
}

.mdr-fact dt {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.mdr-fact dd {
    margin: 0.05rem 0 0;
    font-size: 0.95rem;
    word-break: break-word;
}

.mdr-field--primary .mdr-field__input {
    font-size: 1.05rem;
    padding: 0.6rem 0.75rem;
}

.mdr-field__optional {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted, #6c757d);
}

.mdr-dialog__msg {
    margin: 0 0 0.75rem;
    font-weight: 600;
}

.mdr-candidate-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mdr-candidate-list--charge {
    max-height: 18rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.15rem;
}

.mdr-charge-pick__item {
    margin: 0;
}

.mdr-charge-pick__hit {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    min-height: 3.25rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    text-align: left;
    cursor: pointer;
}

.mdr-charge-pick__hit:hover {
    border-color: var(--brand, #0d6efd);
    background: #f8fbff;
}

.mdr-charge-pick__hit.is-selected {
    border-color: var(--brand, #0d6efd);
    background: #e7f1ff;
    box-shadow: inset 0 0 0 1px var(--brand, #0d6efd);
}

.mdr-charge-pick__title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #212529;
}

.mdr-charge-pick__meta {
    font-size: 0.86rem;
    color: #495057;
    line-height: 1.3;
}

.mdr-charge-pick__scan {
    margin-top: 0.1rem;
    font-size: 0.78rem;
    color: var(--muted, #6c757d);
}

/* Kombinierte Hersteller-/Material-Zuordnung */
.mdr-assign-block {
    margin-top: 0.85rem;
    padding-top: 0.65rem;
    border-top: 1px solid #edf0f2;
}

.mdr-assign-block__title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.mdr-assign-block__note {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--muted, #6c757d);
}

.mdr-assign-block__note--link {
    margin: 0.35rem 0 0.65rem;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-md);
    background: #eef6ff;
    color: #084298;
    font-weight: 500;
}

.mdr-assign-block__fixed {
    margin: 0;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    background: #f4f6f9;
    font-weight: 600;
}

/* Kompakter Zuordnungsdialog (Tablet/Surface) */
.mdr-dialog--assign-compact .mdr-dialog__panel--compact,
.mdr-dialog--assign-compact .media-dialog__panel {
    max-height: min(94dvh, calc(100dvh - 0.5rem));
}

.mdr-dialog--assign-compact .media-dialog__header {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem 0.35rem 0.85rem;
}

.mdr-dialog--assign-compact .media-dialog__title {
    font-size: 1rem;
    line-height: 1.25;
    white-space: normal;
}

.mdr-dialog--assign-compact .media-dialog__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0.45rem 0.85rem 0.35rem;
    gap: 0.3rem;
    overflow: hidden;
}

/* Hersteller-Suche: Body darf scrollen */
.mdr-dialog--assign-compact:not(.mdr-dialog--assign-mat) .media-dialog__body {
    overflow: auto;
}

.mdr-dialog--assign-compact .mdr-dialog__lead {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.25;
    flex: 0 0 auto;
}

.mdr-dialog--assign-compact .mdr-dialog__facts--assign {
    display: grid;
    margin: 0;
    gap: 0.2rem 0.65rem;
    flex: 0 0 auto;
}

/*
 * Gemeinsames Faktengrid (Sammelkonto + Material anlegen).
 * Standard: 3 Spalten. Frueher falsch: max-width:900px und font-size-large
 * haben immer auf 2 Spalten zurueckgeschaltet (Viewport statt Dialogbreite).
 */
.mdr-facts-grid,
.mdr-dialog__facts--cols3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 0.75rem;
    row-gap: 0.25rem;
    margin: 0;
    min-width: 0;
}

.mdr-facts-grid > .mdr-fact,
.mdr-dialog__facts--cols3 > .mdr-fact {
    min-width: 0;
}

.mdr-facts-grid .mdr-fact dt,
.mdr-dialog__facts--cols3 .mdr-fact dt,
.mdr-dialog--assign-compact .mdr-dialog__facts--assign .mdr-fact dt,
.mdr-dialog--create-compact .mdr-dialog__facts--assign .mdr-fact dt {
    font-size: 0.66rem;
}

.mdr-facts-grid .mdr-fact dd,
.mdr-dialog__facts--cols3 .mdr-fact dd,
.mdr-dialog--assign-compact .mdr-dialog__facts--assign .mdr-fact dd,
.mdr-dialog--create-compact .mdr-dialog__facts--assign .mdr-fact dd {
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

/* Code-nahe Werte kompakt halten */
.mdr-facts-grid .mdr-fact:nth-child(-n+2) dd,
.mdr-facts-grid .mdr-fact:nth-child(4) dd,
.mdr-dialog__facts--cols3 .mdr-fact:nth-child(-n+2) dd,
.mdr-dialog__facts--cols3 .mdr-fact:nth-child(4) dd {
    white-space: nowrap;
}

/* 2 Spalten erst unter typischer Dialogbreite (~700px) */
@media (max-width: 699px) {
    .mdr-facts-grid,
    .mdr-dialog__facts--cols3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 1 Spalte nur auf sehr schmalen Viewports */
@media (max-width: 519px) {
    .mdr-facts-grid,
    .mdr-dialog__facts--cols3 {
        grid-template-columns: 1fr;
    }

    .mdr-facts-grid .mdr-fact:nth-child(-n+2) dd,
    .mdr-facts-grid .mdr-fact:nth-child(4) dd,
    .mdr-dialog__facts--cols3 .mdr-fact:nth-child(-n+2) dd,
    .mdr-dialog__facts--cols3 .mdr-fact:nth-child(4) dd {
        white-space: normal;
    }
}

/* Kompakte Herstellerkennungs-Infozeile */
.mdr-assign-ident-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1.3;
    color: #084298;
    flex: 0 0 auto;
}

.mdr-assign-ident-hint .bi {
    flex: 0 0 auto;
    margin-top: 0.1rem;
    font-size: 0.95em;
}

.mdr-dialog--assign-compact .mdr-assign-block {
    margin-top: 0.25rem;
    padding-top: 0.3rem;
    border-top: 1px solid #edf0f2;
}

.mdr-dialog--assign-compact .mdr-assign-block__title {
    margin: 0 0 0.15rem;
    font-size: 0.88rem;
}

.mdr-dialog--assign-compact .mdr-assign-block__note {
    margin: 0 0 0.2rem;
    font-size: 0.78rem;
}

.mdr-dialog--assign-compact .mdr-mfg-picker {
    gap: 0.3rem;
    margin-top: 0.1rem;
}

.mdr-dialog--assign-compact .mdr-mfg-picker__field {
    margin-bottom: 0;
}

.mdr-dialog--assign-compact .mdr-mfg-picker__status {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.2;
}

.mdr-dialog--assign-compact .mdr-mfg-picker__hint {
    margin: 0;
    font-size: 0.78rem;
}

.mdr-dialog--assign-compact .mdr-mfg-picker__selected {
    margin: 0;
    font-size: 0.8rem;
}

.mdr-dialog--assign-compact:not(.mdr-dialog--assign-mat) .mdr-mfg-picker__list {
    max-height: min(30vh, 11.5rem);
}

/*
 * Sammelkonto auswählen:
 * Header/Fakten/Suche/Footer fest; nur .mdr-collective-results scrollt.
 */
.mdr-dialog--assign-mat .mdr-dialog__panel--compact,
.mdr-dialog--assign-mat .media-dialog__panel {
    max-height: min(94dvh, calc(100dvh - 0.5rem));
}

.mdr-dialog--assign-mat .media-dialog__body {
    overflow: hidden;
}

.mdr-dialog--assign-mat .mdr-assign-block--mat {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0.15rem;
    padding-top: 0.2rem;
    border-top: 1px solid #edf0f2;
    overflow: hidden;
}

.mdr-dialog--assign-mat .mdr-assign-block--mat .mdr-mfg-picker__field,
.mdr-dialog--assign-mat .mdr-assign-block--mat .mdr-mfg-picker__status,
.mdr-dialog--assign-mat .mdr-assign-block--mat .mdr-mfg-picker__hint {
    flex: 0 0 auto;
}

.mdr-dialog--assign-mat .mdr-collective-results,
.mdr-dialog--assign-mat .mdr-assign-block--mat .mdr-mfg-picker__list {
    flex: 0 1 auto;
    min-height: 0;
    max-height: min(22rem, 35dvh);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    gap: 0.3rem;
}

.mdr-dialog--assign-mat .mdr-mfg-picker__hit {
    min-height: 2.75rem;
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.65rem;
    box-sizing: border-box;
}

.mdr-dialog--assign-mat .mdr-mfg-picker__hit.is-selected {
    border-color: #0d6efd;
    border-width: 2px;
    background: #e7f1ff;
    box-shadow: none;
}

.mdr-mfg-picker__hit-check {
    flex: 0 0 auto;
    color: #0d6efd;
    font-size: 1.05rem;
    line-height: 1;
}

.mdr-mfg-picker__hit-check[hidden] {
    display: none !important;
}

.mdr-dialog--assign-compact .media-dialog__footer {
    flex: 0 0 auto;
    flex-shrink: 0;
    padding: 0.5rem 0.85rem 0.6rem;
}

.mdr-dialog--assign-compact .media-dialog__footer .btn-primary,
.mdr-dialog--assign-compact .media-dialog__footer .btn-secondary {
    min-height: 2.5rem;
    padding: 0.45rem 0.9rem;
    white-space: normal;
}

html.font-size-large .mdr-dialog--assign-compact:not(.mdr-dialog--assign-mat) .mdr-mfg-picker__list {
    max-height: min(34vh, 13rem);
}

html.font-size-xlarge .mdr-dialog--assign-compact:not(.mdr-dialog--assign-mat) .mdr-mfg-picker__list {
    max-height: min(38vh, 14.5rem);
}

html.font-size-large .mdr-dialog--assign-mat .mdr-collective-results,
html.font-size-xlarge .mdr-dialog--assign-mat .mdr-collective-results,
body.font-size-large .mdr-dialog--assign-mat .mdr-collective-results,
body.font-size-xlarge .mdr-dialog--assign-mat .mdr-collective-results {
    max-height: min(20rem, 32dvh);
}

@media (max-height: 900px) and (min-width: 700px) {
    .mdr-dialog--assign-compact .mdr-dialog__panel--compact,
    .mdr-dialog--assign-compact .media-dialog__panel {
        max-height: min(94dvh, calc(100dvh - 0.5rem));
    }

    .mdr-dialog--assign-mat .mdr-collective-results,
    .mdr-dialog--assign-mat .mdr-assign-block--mat .mdr-mfg-picker__list {
        max-height: min(18rem, 32dvh);
    }

    .mdr-dialog--assign-compact:not(.mdr-dialog--assign-mat) .mdr-mfg-picker__list {
        max-height: min(26vh, 9.5rem);
    }
}


/* Material anlegen: kompakter Faktenblock + engere Formularabstände */
.mdr-dialog--create-compact .mdr-dialog__panel--compact,
.mdr-dialog--create-compact .media-dialog__panel {
    max-height: min(94dvh, calc(100dvh - 0.5rem));
}

.mdr-dialog--create-compact .media-dialog__header {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem 0.35rem 0.85rem;
}

.mdr-dialog--create-compact .media-dialog__title {
    font-size: 1rem;
    line-height: 1.25;
    white-space: normal;
}

.mdr-dialog--create-compact .media-dialog__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0.45rem 0.85rem 0.4rem;
    gap: 0.3rem;
    overflow: auto;
}

.mdr-dialog--create-compact .mdr-dialog__lead {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.25;
    flex: 0 0 auto;
}

.mdr-dialog--create-compact .mdr-dialog__facts--assign {
    display: grid;
    margin: 0 0 0.15rem;
    gap: 0.2rem 0.65rem;
    flex: 0 0 auto;
}

.mdr-dialog--create-compact #mdrCreateForm {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    flex: 0 0 auto;
}

.mdr-dialog--create-compact .mdr-field {
    margin-bottom: 0;
}

.mdr-dialog--create-compact .mdr-field--primary .mdr-field__input {
    font-size: 1rem;
    padding: 0.5rem 0.7rem;
}

.mdr-dialog--create-compact .media-dialog__footer {
    flex: 0 0 auto;
    flex-shrink: 0;
    padding: 0.5rem 0.85rem 0.6rem;
}

/* Suchbare Herstellerauswahl */
.mdr-mfg-picker {
    margin-top: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
}

.mdr-mfg-picker__field {
    margin: 0;
}

.mdr-mfg-picker__status {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted, #6c757d);
}

.mdr-mfg-picker__status--loading {
    color: var(--bs-primary, #0d6efd);
}

.mdr-mfg-picker__status--error {
    color: #842029;
}

.mdr-mfg-picker__status--empty {
    color: var(--muted, #6c757d);
}

.mdr-mfg-picker__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: min(42vh, 18rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.mdr-mfg-picker__item {
    margin: 0;
}

.mdr-mfg-picker__hit {
    width: 100%;
    min-height: 2.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.1rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-md);
    background: var(--surface);
    text-align: left;
    cursor: pointer;
    color: inherit;
}

.mdr-mfg-picker__hit:hover,
.mdr-mfg-picker__hit:focus-visible {
    border-color: #0d6efd;
    background: #f4f8ff;
    outline: none;
}

.mdr-mfg-picker__hit.is-selected {
    border-color: #0d6efd;
    background: #e7f1ff;
    box-shadow: inset 0 0 0 1px #0d6efd;
}

.mdr-mfg-picker__hit-name {
    font-weight: 600;
    font-size: 0.98rem;
    word-break: break-word;
}

.mdr-mfg-picker__hit-idents {
    font-size: 0.8rem;
    color: var(--muted, #6c757d);
}

.mdr-mfg-picker__hint,
.mdr-mfg-picker__selected {
    margin: 0;
    font-size: 0.88rem;
    color: var(--muted, #6c757d);
}

.mdr-mfg-picker__selected {
    font-weight: 600;
    color: var(--text, #212529);
}

html.font-size-large .mdr-mfg-picker__list {
    max-height: min(46vh, 20rem);
}

html.font-size-xlarge .mdr-mfg-picker__list {
    max-height: min(50vh, 22rem);
}

@media (max-width: 640px) {
    .mdr-mfg-picker__list {
        max-height: min(36vh, 14rem);
    }
}

/* Sammelkonto-Trefferliste: globale List-max-height überschreiben */
html.font-size-large .mdr-dialog--assign-mat .mdr-collective-results,
html.font-size-xlarge .mdr-dialog--assign-mat .mdr-collective-results,
body.font-size-large .mdr-dialog--assign-mat .mdr-collective-results,
body.font-size-xlarge .mdr-dialog--assign-mat .mdr-collective-results {
    max-height: min(20rem, 32dvh);
}

@media (max-width: 640px) {
    .mdr-dialog--assign-mat .mdr-collective-results,
    .mdr-dialog--assign-mat .mdr-assign-block--mat .mdr-mfg-picker__list {
        max-height: min(16rem, 30dvh);
    }
}

.mdr-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.65rem;
}

.mdr-field__label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted, #6c757d);
}

.mdr-field__input {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    font-size: 1rem;
}

.mdr-create-lotfacts {
    margin: 0.75rem 0 0;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.mdr-create-lotfacts legend {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0 0.25rem;
}

html.font-size-large .mdr-table,
body.font-size-large .mdr-table {
    font-size: 0.95rem;
}

html.font-size-xlarge .mdr-table,
body.font-size-xlarge .mdr-table {
    font-size: 1.02rem;
}

@media (max-width: 1100px) {
    .mdr-table thead {
        display: none;
    }

    .mdr-table,
    .mdr-table tbody,
    .mdr-table tr,
    .mdr-table td {
        display: block;
        width: 100%;
    }

    .mdr-table tr {
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        padding: 0.55rem 0.65rem;
    }

    .mdr-table td {
        border: 0;
        padding: 0.15rem 0;
    }

    .mdr-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--muted, #6c757d);
    }

    .mdr-cell--ref,
    .mdr-cell--mat,
    .mdr-cell--scan {
        font-size: 1rem;
        font-weight: 700;
    }

    .mdr-cell--ref {
        white-space: nowrap;
        overflow-x: auto;
    }

    .mdr-cell--dates .mdr-date-stack {
        white-space: nowrap;
    }

    .mdr-cell--action {
        margin-top: 0.35rem;
    }
}

@media (max-width: 640px) {
    .mdr-item__facts:not(.mdr-facts-grid):not(.mdr-dialog__facts--cols3),
    .mdr-dialog__facts:not(.mdr-facts-grid):not(.mdr-dialog__facts--cols3) {
        grid-template-columns: 1fr;
    }
}

/* Universeller Bestätigungsdialog (TecConfirm) */
.tec-confirm {
    position: fixed;
    inset: 0;
    z-index: 12050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.tec-confirm[hidden] {
    display: none !important;
}

.tec-confirm__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 28, 40, 0.45);
}

.tec-confirm__panel {
    position: relative;
    z-index: 1;
    width: min(420px, calc(100vw - 1.5rem));
    max-height: min(90dvh, calc(100dvh - 1.5rem));
    overflow: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

html.font-size-large .tec-confirm__panel {
    width: min(480px, calc(100vw - 1.25rem));
}

html.font-size-xlarge .tec-confirm__panel {
    width: min(540px, calc(100vw - 1rem));
}

.tec-confirm__header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.85rem 0.85rem 0.55rem 1rem;
    border-bottom: 1px solid #edf0f2;
}

.tec-confirm__title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text, #212529);
}

.tec-confirm__icon {
    flex: 0 0 auto;
    font-size: 1.35em;
    line-height: 1;
}

.tec-confirm--info .tec-confirm__icon { color: #0d6efd; }
.tec-confirm--warning .tec-confirm__icon { color: #b78103; }
.tec-confirm--danger .tec-confirm__icon { color: #b02a37; }
.tec-confirm--success .tec-confirm__icon { color: #198754; }

.tec-confirm__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    min-width: 44px;
    min-height: 44px;
    margin: -0.35rem -0.25rem 0 0;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: #495057;
    font-size: 1.2rem;
    cursor: pointer;
}

.tec-confirm__close:hover,
.tec-confirm__close:focus-visible {
    background: var(--surface-hover);
    color: #212529;
    outline: none;
}

.tec-confirm__body {
    padding: 0.85rem 1rem 0.5rem;
}

.tec-confirm__message {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.4;
    color: var(--text, #212529);
}

.tec-confirm__details {
    margin: 0.75rem 0 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem 0.85rem;
}

.tec-confirm__fact {
    min-width: 0;
}

/* Einzelnes letztes Detail über volle Breite (ruhigeres Layout) */
.tec-confirm__fact:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.tec-confirm__fact dt {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tec-confirm__fact dd {
    margin: 0.05rem 0 0;
    font-size: 0.92rem;
    word-break: break-word;
}

.tec-confirm__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-end;
    padding: 0.75rem 1rem 1rem;
}

.tec-confirm__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.75rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    flex: 1 1 auto;
}

.tec-confirm__btn .bi {
    font-size: 1.05em;
}

.tec-confirm__btn--secondary {
    background: var(--surface);
    border-color: var(--border-input);
    color: #343a40;
}

.tec-confirm__btn--secondary:hover,
.tec-confirm__btn--secondary:focus-visible {
    background: #f8f9fa;
    border-color: #adb5bd;
    outline: none;
}

.tec-confirm__btn--primary.tec-confirm__btn--info {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.tec-confirm__btn--primary.tec-confirm__btn--warning {
    background: #dd9f0c;
    border-color: #b78103;
    color: #212529;
}

.tec-confirm__btn--primary.tec-confirm__btn--danger {
    background: #dc3545;
    border-color: #b02a37;
    color: #fff;
}

.tec-confirm__btn--primary.tec-confirm__btn--success {
    background: #198754;
    border-color: #146c43;
    color: #fff;
}

.tec-confirm__btn--primary:hover,
.tec-confirm__btn--primary:focus-visible {
    filter: brightness(0.96);
    outline: none;
}

html.tec-confirm-open,
html.tec-confirm-open body {
    overflow: hidden;
}

@media (max-width: 480px) {
    .tec-confirm {
        align-items: flex-end;
        padding: 0.5rem;
    }

    .tec-confirm__panel {
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) var(--radius-md) var(--radius-md);
    }

    .tec-confirm__details {
        grid-template-columns: 1fr;
    }

    .tec-confirm__btn {
        flex: 1 1 100%;
    }
}

/* ----- Auftragshinweise (eigener Reiter, zweispaltig ab xl) ----- */
.hinweise-page {
    margin: 0;
}

.hinweise-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Klein: Eingabe zuerst, Liste darunter */
.hinweise-layout__form {
    order: -1;
}

.hinweise-layout__list,
.hinweise-layout__form {
    min-width: 0;
    padding: 0.85rem 1rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.hinweise-col__head {
    margin-bottom: 0.75rem;
}

.hinweise-col__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.hinweise-col__hint {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.hinweise-form {
    margin: 0;
}

.hinweise-art {
    margin: 0 0 0.65rem;
    padding: 0;
    border: 0;
    min-width: 0;
}

.hinweise-art__legend,
.hinweise-form__label {
    display: block;
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.hinweise-art__options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.hinweise-art__option {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: var(--radius-md);
    background: #f8f9fa;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.hinweise-art__option input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
}

.hinweise-art__option--abrechnung:has(input:checked),
.hinweise-art__option--abrechnung.is-selected {
    border-color: #fd7e14;
    background: #fff4e6;
    color: #9a3412;
}

.hinweise-art__option--naechster:has(input:checked),
.hinweise-art__option--naechster.is-selected {
    border-color: #0dcaf0;
    background: #e7f7fb;
    color: #0c5460;
}

.hinweise-form__text {
    display: block;
    width: 100%;
    min-height: 7rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-input, #ced4da);
    border-radius: var(--radius-md);
    font: inherit;
    line-height: 1.4;
    resize: vertical;
}

.hinweise-form__text:focus {
    outline: none;
    border-color: var(--brand, #0d6efd);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.18);
}

.hinweise-form__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: 0.55rem;
}

.hinweise-form__count {
    font-size: 0.8rem;
    color: var(--muted);
}

.hinweise-form__count--warn {
    color: #b45309;
    font-weight: 600;
}

.hinweise-form__save {
    width: auto;
    margin-top: 0;
    min-height: 2.6rem;
    padding: 0.55rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.hinweise-page__status {
    margin: 0 0 0.5rem;
    font-size: 0.88rem;
    color: #0c5460;
}

.hinweise-page__error {
    margin: 0 0 0.5rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
    font-size: 0.88rem;
}

.hinweise-list__empty {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.hinweise-item {
    padding: 0.65rem 0;
    border-top: 1px solid #f1f3f5;
}

.hinweise-item:first-of-type {
    border-top: 0;
}

.hinweise-item__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.65rem;
    margin-bottom: 0.25rem;
}

.hinweise-item__art {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
}

.hinweise-item__art--abrechnung {
    background: #fff4e6;
    color: #9a3412;
}

.hinweise-item__art--naechster {
    background: #e7f7fb;
    color: #0c5460;
}

.hinweise-item__who {
    font-size: 0.82rem;
    color: var(--muted);
}

.hinweise-item__text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
    line-height: 1.45;
}

/* xl (~Bootstrap col-xl): Liste links, Eingabe rechts, 50/50 */
@media (min-width: 1200px) {
    .hinweise-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 1.25rem;
        align-items: start;
    }

    .hinweise-layout__list,
    .hinweise-layout__form {
        order: 0;
    }

    .hinweise-layout__list {
        max-height: calc(100dvh - 13.5rem);
        overflow-x: hidden;
        overflow-y: auto;
    }

    .hinweise-layout__form {
        position: sticky;
        top: 0.35rem;
    }
}

@media (max-width: 640px) {
    .hinweise-art__option {
        flex: 1 1 calc(50% - 0.25rem);
        justify-content: center;
    }

    .hinweise-form__save {
        width: 100%;
        justify-content: center;
    }
}

/* ----- Kundenportal-Kommunikation (eigener Reiter) ----- */
.kommunikation-page {
    margin: 0;
}

.kommunikation-empty {
    padding: 1.25rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.kommunikation-empty__hint {
    margin: 0.5rem 0 0;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.45;
}

.kommunikation-empty__text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--muted);
}

.kommunikation-main {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-height: 0;
    padding: 0.75rem 0.85rem 0.85rem;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.kommunikation-head__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.kommunikation-head__subject {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    color: var(--muted);
}

.kommunikation-page__status {
    margin: 0;
    font-size: 0.88rem;
    color: #0c5460;
}

.kommunikation-page__error {
    margin: 0;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
    font-size: 0.88rem;
}

.kommunikation-col__hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.kommunikation-thread-wrap {
    flex: 1 1 auto;
    min-height: 8rem;
    max-height: calc(100vh - 22rem);
    max-height: calc(100dvh - 22rem);
    overflow: hidden;
    border: 1px solid #e9ecef;
    border-radius: var(--radius-md);
    background: #f8f9fa;
}

.kommunikation-thread {
    height: 100%;
    max-height: inherit;
    overflow-y: auto;
    padding: 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.kommunikation-thread__empty {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--muted);
}

/* Nachtragszeilen wie Kundenportal: volle Breite, Inhalt links / Anhänge rechts */
.komm-followup {
    border-left: 3px solid #0d6efd;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 0 0 0.75rem;
    padding: 0.45rem 0.65rem 0.55rem;
    background: #f8f9fa;
    font-size: 0.875rem;
}

.komm-followup--lab {
    border-left-color: #198754;
}

.komm-followup--system {
    border-left-color: #868e96;
    border-left-style: dashed;
}

.komm-followup__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
}

.komm-followup__grid--solo {
    grid-template-columns: minmax(0, 1fr);
}

.komm-followup__content,
.komm-followup__attachments {
    min-width: 0;
}

.komm-followup__card,
.komm-followup__att-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.komm-followup__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid #eef1f4;
    background: #fff;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.komm-followup__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
}

.komm-followup__badge--customer {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

.komm-followup__badge--lab {
    background: rgba(25, 135, 84, 0.12);
    color: #198754;
}

.komm-followup__badge--system {
    background: rgba(108, 117, 125, 0.14);
    color: #495057;
}

.komm-followup__when,
.komm-followup__who {
    font-size: 0.8rem;
    color: var(--muted);
}

.komm-followup__who {
    width: 100%;
}

.komm-followup__body {
    padding: 0.65rem 0.75rem 0.75rem;
}

.komm-followup__text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.komm-followup__att-head {
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid #eef1f4;
    font-size: 0.82rem;
    font-weight: 600;
    background: #fff;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.komm-followup__att-body {
    padding: 0.55rem 0.65rem 0.65rem;
}

.komm-att__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.komm-att__item {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    min-width: 0;
}

.komm-att__media {
    flex-shrink: 0;
}

.komm-att__thumb {
    display: block;
    width: auto;
    height: auto;
    max-width: 7.5rem;
    max-height: 5.5rem;
    object-fit: contain;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-sm);
    background: #f8f9fa;
    cursor: pointer;
}

.komm-att__thumb:hover {
    opacity: 0.9;
}

.komm-att__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-sm);
    background: #f8f9fa;
    color: #64748b;
    font-size: 1.15rem;
}

.komm-att__meta {
    min-width: 0;
    flex: 1 1 auto;
}

.komm-att__name {
    font-size: 0.82rem;
    font-weight: 600;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.komm-att__facts {
    margin-top: 0.1rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.komm-att__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    margin-top: 0.25rem;
}

.komm-att__action {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.78rem;
    color: #0d6efd;
    text-decoration: none;
    cursor: pointer;
}

.komm-att__action:hover,
.komm-att__action:focus-visible {
    color: #0a58ca;
    text-decoration: underline;
}

@media (max-width: 991.98px) {
    .komm-followup__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 767.98px) {
    .kommunikation-thread-wrap {
        max-height: calc(100vh - 26rem);
        max-height: calc(100dvh - 26rem);
    }

    .komm-att__thumb {
        max-width: 6.5rem;
        max-height: 5rem;
    }
}

.kommunikation-composer {
    margin: 0;
    padding-top: 0.3rem;
    border-top: 1px solid #e9ecef;
}

.kommunikation-composer__label {
    display: block;
    margin: 0 0 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.kommunikation-composer__text {
    display: block;
    width: 100%;
    min-height: 3.5rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-input, #ced4da);
    border-radius: var(--radius-md);
    font: inherit;
    line-height: 1.4;
    resize: vertical;
}

.kommunikation-composer__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.55rem;
}

.kommunikation-composer__btn {
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0.35rem 0.55rem;
}

.kommunikation-composer__hint {
    flex: 1 1 10rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.kommunikation-composer__send {
    margin-left: auto;
}

.kommunikation-pending {
    list-style: none;
    margin: 0.55rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kommunikation-pending__item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid #dee2e6;
    border-radius: var(--radius-sm);
    background: #f8f9fa;
    font-size: 0.82rem;
}

.kommunikation-pending__thumb {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.kommunikation-pending__icon {
    width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
}

.kommunikation-pending__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kommunikation-pending__size {
    color: var(--muted);
    flex-shrink: 0;
}

.kommunikation-pending__remove {
    border: 0;
    background: transparent;
    color: #842029;
    padding: 0.2rem;
    cursor: pointer;
}

.kommunikation-camera {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
}

/* display:flex oben ueberschreibt sonst das HTML-Attribut hidden (UA-Style). */
.kommunikation-camera[hidden] {
    display: none !important;
}

.kommunikation-camera__panel {
    width: min(100%, 28rem);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 0.85rem 1rem 1rem;
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-md);
}

.kommunikation-camera__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.kommunikation-camera__title {
    margin: 0;
    font-size: 1rem;
}

.kommunikation-camera__close {
    border: 0;
    background: transparent;
    font-size: 1.1rem;
    cursor: pointer;
}

.kommunikation-camera__hint,
.kommunikation-camera__error {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
}

.kommunikation-camera__error {
    color: #842029;
}

.kommunikation-camera__viewport {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.kommunikation-camera__video,
.kommunikation-camera__preview {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kommunikation-camera__select-wrap {
    margin-top: 0.55rem;
}

.kommunikation-camera__select {
    width: 100%;
}

.kommunikation-camera__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.kommunikation-camera__actions[hidden],
.kommunikation-camera__select-wrap[hidden],
.kommunikation-camera__video[hidden],
.kommunikation-camera__preview[hidden],
.kommunikation-camera__error[hidden],
.kommunikation-camera__hint[hidden] {
    display: none !important;
}

@media (max-width: 575px) {
    .kommunikation-composer__send {
        width: 100%;
        margin-left: 0;
    }
}

/* Bootstrap Collapse (ohne volles Bootstrap-CSS) */
.collapse:not(.show) {
    display: none;
}

.collapsing {
    height: 0;
    overflow: hidden;
    transition: height 0.28s ease;
}

/* Startseite: Arbeits-Accordion (kompakt) */
.works--queues {
    padding: 0.7rem 0.8rem 0.85rem;
}

.works--queues .works__head {
    margin-bottom: 0.45rem;
    gap: 0.4rem;
}

.works--queues .works__title {
    font-size: 0.95rem;
    font-weight: 600;
}

.works-view-switch {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0 0 0.65rem;
    padding: 0.2rem;
    border: 1px solid var(--border, #ced4da);
    border-radius: var(--radius-md, 0.5rem);
    background: var(--surface-muted, #eef2f7);
}

.works-view-switch__btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text, #212529);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.4rem 0.75rem;
    border-radius: 0.35rem;
    cursor: pointer;
}

.works-view-switch__btn:hover {
    background: rgba(13, 110, 253, 0.08);
}

.works-view-switch__btn.is-active {
    background: #fff;
    color: var(--brand, #0d6efd);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.works-view[hidden] {
    display: none !important;
}

.badge--active-work {
    background: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
    font-weight: 700;
}

.badge--assignment {
    background: #e7f1ff;
    color: #084298;
    border: 1px solid #cfe2ff;
    font-weight: 700;
}

.work-order-card--active {
    border-color: #ffc107;
}

.work-order-card--removing {
    opacity: 0;
    transition: opacity 0.16s ease;
    pointer-events: none;
}

.result-status-block {
    margin-top: 0.75rem;
    padding-top: 0.7rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.result-status-block__group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
}

.result-status-block__lines {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.result-status-block__line {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text, #212529);
    line-height: 1.3;
}

.result-card__col--info > .result-actions {
    margin-top: 0.7rem;
}

.tec-works-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tec-works-accordion .accordion-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: none;
    overflow: hidden;
}

.tec-works-accordion .accordion-header {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}

.tec-works-accordion .accordion-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.35rem;
    padding: 0.4rem 0.7rem;
    border: 0;
    background: var(--surface-muted, #eef2f7);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.tec-works-accordion .accordion-button:hover {
    background: #e7edf5;
}

.tec-works-accordion .accordion-button:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.tec-works-accordion .accordion-button::after {
    content: "";
    margin-left: auto;
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid #6c757d;
    border-bottom: 2px solid #6c757d;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex: 0 0 auto;
}

.tec-works-accordion .accordion-button:not(.collapsed)::after {
    transform: rotate(-135deg);
}

.tec-works-accordion .accordion-button.collapsed {
    background: var(--surface);
}

/* Queue-Header: dezente Farbverlaeufe (nur Button, nicht Body) */
.tec-works-accordion .tec-queue-active .accordion-button.collapsed {
    background: linear-gradient(90deg, #dce9f8 0%, #eef4fa 100%);
}

.tec-works-accordion .tec-queue-active .accordion-button:not(.collapsed) {
    background: linear-gradient(90deg, #c8ddf4 0%, #e4eef8 100%);
}

.tec-works-accordion .tec-queue-active .accordion-button:hover {
    background: linear-gradient(90deg, #cfe0f5 0%, #e7f0f9 100%);
}

.tec-works-accordion .tec-queue-assigned-me .accordion-button.collapsed {
    background: linear-gradient(90deg, #d9eef2 0%, #eef7f8 100%);
}

.tec-works-accordion .tec-queue-assigned-me .accordion-button:not(.collapsed) {
    background: linear-gradient(90deg, #c5e6ed 0%, #e4f3f5 100%);
}

.tec-works-accordion .tec-queue-assigned-me .accordion-button:hover {
    background: linear-gradient(90deg, #cee9f0 0%, #e8f5f7 100%);
}

.tec-works-accordion .tec-queue-assigned-department .accordion-button.collapsed {
    background: linear-gradient(90deg, #e4e6f4 0%, #f2f3f9 100%);
}

.tec-works-accordion .tec-queue-assigned-department .accordion-button:not(.collapsed) {
    background: linear-gradient(90deg, #d5d9ef 0%, #eceef7 100%);
}

.tec-works-accordion .tec-queue-assigned-department .accordion-button:hover {
    background: linear-gradient(90deg, #dce0f1 0%, #eff0f8 100%);
}

.tec-works-accordion .tec-queue-unassigned .accordion-button.collapsed {
    background: linear-gradient(90deg, #e4e8ed 0%, #f2f4f6 100%);
}

.tec-works-accordion .tec-queue-unassigned .accordion-button:not(.collapsed) {
    background: linear-gradient(90deg, #d6dde5 0%, #eceff2 100%);
}

.tec-works-accordion .tec-queue-unassigned .accordion-button:hover {
    background: linear-gradient(90deg, #dde3ea 0%, #f0f2f4 100%);
}

.tec-works-accordion .tec-queue-department .accordion-button.collapsed {
    background: linear-gradient(90deg, #e8eef5 0%, #f4f6f9 100%);
}

.tec-works-accordion .tec-queue-department .accordion-button:not(.collapsed) {
    background: linear-gradient(90deg, #dce6f1 0%, #eef2f7 100%);
}

.tec-works-accordion .tec-queue-department .accordion-button:hover {
    background: linear-gradient(90deg, #e2eaf3 0%, #f1f4f8 100%);
}

/* Abteilungsfarben aus DEWIS (CSS-Variablen am Item).
   Chevron ist eigenes Border-Pfeil-Pseudo (::after), Farbe via currentColor. */
.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button,
.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button:hover,
.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button:focus,
.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button:focus-visible,
.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button.collapsed,
.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button:not(.collapsed) {
    color: var(--department-fg, var(--text, #212529));
}

.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button::after {
    background-image: none;
    border-right-color: currentColor;
    border-bottom-color: currentColor;
}

.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button.collapsed {
    background: linear-gradient(
        90deg,
        var(--department-bg, #e8eef5) 0%,
        var(--department-bg-soft, #f4f6f9) 100%
    );
}

.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button:not(.collapsed) {
    background: linear-gradient(
        90deg,
        var(--department-bg-open, var(--department-bg, #dce6f1)) 0%,
        var(--department-bg-soft, #eef2f7) 100%
    );
    color: var(--department-fg, var(--text, #212529));
}

.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button:hover {
    background: linear-gradient(
        90deg,
        var(--department-bg, #e2eaf3) 0%,
        var(--department-bg-soft, #f1f4f8) 100%
    );
    color: var(--department-fg, var(--text, #212529));
}

.tec-works-accordion__label {
    min-width: 0;
}

.tec-works-accordion__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.32rem;
    border-radius: 999px;
    background: var(--brand, #0d6efd);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

/* Abteilungs-fg darf Count-Badge nicht vererben (weisse Zahl auf blau). */
.tec-works-accordion .tec-queue-department .tec-works-accordion__count,
.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button .tec-works-accordion__count,
.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button:hover .tec-works-accordion__count,
.tec-works-accordion .tec-queue-department.has-department-colors .accordion-button:not(.collapsed) .tec-works-accordion__count {
    background: var(--brand, #0d6efd);
    color: #fff;
}

.tec-works-accordion__count[hidden] {
    display: none !important;
}

.tec-works-accordion .accordion-body {
    padding: 0.4rem 0.65rem 0.55rem;
}

.work-queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.works__loading {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0.15rem 0;
}

.works--queues .works__empty {
    padding: 0.15rem 0;
}

.works--queues .works__empty-text {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted, #6c757d);
}

/* Zuweisungsdialog (Arbeitsuebersicht) */
.assign-overlay {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.assign-overlay[hidden] {
    display: none !important;
}

.assign-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(33, 37, 41, 0.45);
}

.assign-dialog {
    position: relative;
    z-index: 1;
    width: min(28rem, 100%);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #ced4da);
    border-radius: var(--radius-md, 0.5rem);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18);
}

.assign-dialog__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem 0.55rem;
    border-bottom: 1px solid #e9ecef;
}

.assign-dialog__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text, #212529);
}

.assign-dialog__meta {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--muted, #6c757d);
}

.assign-dialog__body {
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.assign-modes {
    margin: 0;
    padding: 0;
    border: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.assign-modes__legend {
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted, #6c757d);
}

.assign-mode {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.92rem;
    color: var(--text, #212529);
    cursor: pointer;
}

.assign-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.assign-field__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted, #6c757d);
}

.assign-field__select {
    width: 100%;
    min-height: 2.25rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border-input, #ced4da);
    border-radius: 0.35rem;
    background: #fff;
    color: var(--text, #212529);
    font: inherit;
}

.assign-intro {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text, #212529);
}

.assign-release-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md, 0.5rem);
    border: 1px solid #ffe69c;
    background: #fff8e6;
    color: #664d03;
    font-size: 0.9rem;
    line-height: 1.35;
}

/* display:flex darf HTML-hidden nicht ueberschreiben */
.assign-release-hint[hidden],
.assign-release-hint.is-hidden {
    display: none !important;
}

.assign-release-hint__icon {
    flex: 0 0 auto;
    margin-top: 0.1rem;
    font-size: 1.1rem;
    color: #b58100;
}

.assign-release-hint__text {
    margin: 0;
}

.assign-active-hint__lead,
.assign-active-hint__sub,
.assign-active-hint__foot {
    margin: 0;
}

.assign-active-hint__sub {
    margin-top: 0.55rem;
    font-weight: 600;
}

.assign-active-hint__list {
    margin: 0.25rem 0 0.55rem;
    padding-left: 1.15rem;
}

.assign-active-hint__list li {
    margin: 0.1rem 0;
}

.assign-active-hint__foot {
    font-size: 0.86rem;
}

.btn-action--release {
    border-color: #b58100;
    background: linear-gradient(180deg, #ffda6a 0%, #ffc107 45%, #e0a800 100%);
    color: #3d2e00;
    box-shadow: 0 1px 3px rgba(181, 129, 0, 0.28);
    text-shadow: none;
}

.btn-action--primary {
    /* Standard-Primary der bestehenden btn-action belassen; Klasse fuer JS-Toggle. */
}

.btn-action--release:hover:not(:disabled) {
    border-color: #997404;
    background: linear-gradient(180deg, #ffe69c 0%, #ffc107 40%, #cc9a06 100%);
    color: #332500;
}

.assign-error {
    margin: 0;
    padding: 0.45rem 0.55rem;
    border-radius: 0.35rem;
    background: #f8d7da;
    color: #842029;
    font-size: 0.85rem;
}

.assign-dialog__foot {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.7rem 1rem 0.9rem;
    border-top: 1px solid #e9ecef;
}


