/* ==========================================================================
   Gemeinsame Basis (Farben, Icons) und moderne Kopfzeile (SW-118)
   ========================================================================== */

:root {
    --sd-brand: #006eb6;
    --sd-brand-dark: #00568f;
    --sd-brand-soft: #e6f1fa;
    --sd-accent: #f08a00;
    --sd-bg: #f5f7fa;
    --sd-surface: #ffffff;
    --sd-border: #e3e8ef;
    --sd-text: #1f2937;
    --sd-muted: #6b7280;
    --sd-nav: #46586a;
    --sd-hover: #f3f6f9;
    --sd-content-width: 1248px;
    --sd-radius: 10px;
    --sd-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --sd-shadow-lg: 0 10px 30px rgba(16, 24, 40, .14);
}

.sd-i {
    width: 16px;
    height: 16px;
    flex: none;
    vertical-align: -3px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sd-i-sm {
    width: 14px;
    height: 14px;
}

/* ---------- Kopfzeile (angelehnt an www.sixdata.de) ---------- */
.sd-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid #e4e9ee;
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    backdrop-filter: saturate(1.6) blur(14px);
}

.sd-topbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 28px;
    max-width: var(--sd-content-width);
    min-height: 68px;
    margin: 0 auto;
    padding: 0 24px;
}

.sd-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
}

.sd-brand-logo img {
    height: 38px;
}

.sd-brand-text {
    padding-left: 12px;
    border-left: 1px solid var(--sd-border);
    color: var(--sd-muted);
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sd-topbar-toggle {
    display: none;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-left: auto;
    color: var(--sd-text);
    background: var(--sd-surface);
    border: 1px solid var(--sd-border);
    border-radius: 8px;
}

    .sd-topbar-toggle .sd-i {
        width: 20px;
        height: 20px;
    }

.sd-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    flex: 1;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sd-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--sd-nav);
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none !important;
}

    .sd-nav-link:hover,
    .sd-nav-link:focus,
    .open > .sd-nav-link {
        color: var(--sd-text);
        background: var(--sd-hover);
    }

    .sd-nav-link.active {
        color: var(--sd-brand);
    }

.sd-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- Dropdown-Menüs in der Kopfzeile ---------- */
.sd-topbar .dropdown-menu.sd-menu {
    min-width: 220px;
    margin-top: 8px;
    padding: 6px;
    font-size: 14px;
    background: var(--sd-surface);
    border: 1px solid var(--sd-border) !important;
    border-radius: var(--sd-radius);
    box-shadow: var(--sd-shadow-lg);
}

.sd-topbar nav .sd-menu > li > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--sd-text);
    opacity: 1;
    white-space: nowrap;
}

    .sd-topbar nav .sd-menu > li > a:hover,
    .sd-topbar nav .sd-menu > li > a:focus {
        color: var(--sd-text);
        background: var(--sd-bg);
    }

.sd-topbar nav .sd-menu > li.active > a,
.sd-topbar nav .sd-menu > li.active > a:hover {
    color: var(--sd-brand);
    background: var(--sd-brand-soft);
}

.sd-topbar nav .sd-menu-rich > li > a {
    align-items: flex-start;
}

    .sd-topbar nav .sd-menu-rich > li > a .sd-i {
        margin-top: 2px;
    }

.sd-menu-rich small {
    display: block;
    color: var(--sd-muted);
    font-size: 12px;
}

/* ---------- Kundenauswahl (nur Administratoren) ---------- */
.sd-customer-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    max-width: 280px;
    padding: 0 16px;
    color: var(--sd-text);
    font-size: 14px;
    background: var(--sd-surface);
    border: 1px solid var(--sd-border);
    border-radius: 999px;
}

    .sd-customer-btn:hover {
        border-color: #c9d3df;
    }

.sd-customer-label {
    color: var(--sd-muted);
}

.sd-customer-value {
    overflow: hidden;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sd-customer-btn.is-empty {
    color: var(--sd-accent);
    border-style: dashed;
    border-color: var(--sd-accent);
}

    .sd-customer-btn.is-empty .sd-customer-value {
        font-weight: 500;
    }

.sd-customer-btn.is-pulsing {
    animation: sd-pulse .9s ease 2;
}

@keyframes sd-pulse {
    50% {
        box-shadow: 0 0 0 4px rgba(240, 138, 0, .35);
    }
}

.sd-topbar .dropdown-menu.sd-customer-menu {
    width: 320px;
}

.sd-customer-hint {
    margin-bottom: 6px;
    padding: 8px 10px;
    color: #9a5800;
    font-size: 13px;
    background: #fff4e5;
    border-radius: 6px;
}

.sd-customer-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    margin: 0 0 6px;
    padding: 0 8px;
    color: var(--sd-muted);
    font-weight: normal;
    border: 1px solid var(--sd-border);
    border-radius: 6px;
}

    .sd-customer-search:focus-within {
        border-color: var(--sd-brand);
        box-shadow: 0 0 0 3px rgba(0, 110, 182, .15);
    }

    .sd-customer-search input {
        flex: 1;
        min-width: 0;
        color: var(--sd-text);
        background: transparent;
        border: 0;
        outline: 0;
    }

.sd-customer-list {
    max-height: 280px;
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
}

    .sd-customer-list button {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 8px 10px;
        color: var(--sd-text);
        text-align: left;
        background: transparent;
        border: 0;
        border-radius: 6px;
    }

        .sd-customer-list button:hover,
        .sd-customer-list button:focus {
            background: var(--sd-bg);
            outline: none;
        }

        .sd-customer-list button .sd-i {
            margin-left: auto;
            visibility: hidden;
        }

        .sd-customer-list button.is-selected {
            color: var(--sd-brand);
            font-weight: 600;
            background: var(--sd-brand-soft);
        }

            .sd-customer-list button.is-selected .sd-i {
                visibility: visible;
            }

.sd-customer-empty {
    padding: 8px 10px;
    color: var(--sd-muted);
}

.sd-customer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    padding: 8px 10px 4px;
    color: var(--sd-muted);
    font-size: 12px;
    border-top: 1px solid var(--sd-border);
}

.sd-link-btn {
    padding: 0;
    color: var(--sd-brand);
    font-size: 12px;
    white-space: nowrap;
    background: none;
    border: 0;
}

    .sd-link-btn:hover {
        text-decoration: underline;
    }

/* ---------- Benutzermenü ---------- */
.sd-user {
    margin: 0;
}

.sd-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px 0 3px;
    color: var(--sd-nav);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    background: var(--sd-surface);
    border: 1px solid var(--sd-border);
    border-radius: 999px;
}

    .sd-user-btn:hover,
    .open > .sd-user-btn {
        color: var(--sd-text);
        background: var(--sd-hover);
    }

.sd-avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    color: var(--sd-brand);
    font-size: 13px;
    font-weight: 600;
    background: var(--sd-brand-soft);
    border-radius: 50%;
}

.sd-admin-tag {
    padding: 1px 6px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    background: #0d2340;
    border-radius: 4px;
}

.sd-eyebrow {
    margin-bottom: 6px;
    color: var(--sd-brand);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

/* ---------- Footer (kompakt, dunkel) ---------- */
body.sd-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-bottom: 0;
}

    body.sd-page > .body-content {
        flex: 1 0 auto;
        width: 100%;
        padding-top: 20px;
        padding-bottom: 32px;
    }

.sd-footer {
    width: 100%;
    margin-top: auto;
    color: #c7d3e3;
    font-size: 14px;
    background: #0d2340;
}

.sd-footer-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px 32px;
    max-width: var(--sd-content-width);
    margin: 0 auto;
    padding: 22px 24px;
}

.sd-footer-brand {
    color: #fff;
    font-weight: 600;
}

    .sd-footer-brand small {
        display: block;
        color: #8fa3bd;
        font-size: 13px;
        font-weight: 400;
    }

.sd-footer-contact {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

    .sd-footer-contact a {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 7px 14px;
        color: #fff;
        white-space: nowrap;
        text-decoration: none;
        background: rgba(255, 255, 255, .08);
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 999px;
    }

        .sd-footer-contact a:hover,
        .sd-footer-contact a:focus {
            color: #fff;
            text-decoration: none;
            background: rgba(255, 255, 255, .16);
        }

.sd-footer-legal {
    display: flex;
    flex-wrap: nowrap;
    gap: 18px;
    font-size: 13px;
    white-space: nowrap;
}

    .sd-footer-legal a {
        color: #c7d3e3;
    }

        .sd-footer-legal a:hover,
        .sd-footer-legal a:focus {
            color: #fff;
        }

.sd-footer-bottom {
    max-width: var(--sd-content-width);
    margin: 0 auto;
    padding: 10px 24px 14px;
    color: #8fa3bd;
    font-size: 12px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

@media (max-width: 991px) {
    .sd-footer-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .sd-footer-bottom {
        text-align: center;
    }
}

/* ---------- Responsive ---------- */
@media (min-width: 992px) {
    .sd-topbar-collapse.collapse {
        display: flex !important;
        flex: 1;
        align-items: center;
        gap: 16px;
        height: auto !important;
    }

    .sd-nav-link.active::after {
        content: "";
        position: absolute;
        right: 14px;
        bottom: -13px;
        left: 14px;
        height: 2px;
        background: var(--sd-brand);
        border-radius: 2px;
    }
}

@media (min-width: 992px) and (max-width: 1279px) {
    .sd-customer-label,
    .sd-user-name {
        display: none;
    }

    .sd-customer-btn {
        max-width: 200px;
    }
}

@media (max-width: 991px) {
    .sd-topbar-inner {
        padding: 10px 16px;
    }

    .sd-topbar-toggle {
        display: grid;
    }

    .sd-topbar-collapse {
        flex-basis: 100%;
    }

        .sd-topbar-collapse.in {
            display: block;
        }

    .sd-nav {
        flex-direction: column;
        align-items: stretch;
        padding-top: 12px;
    }

    .sd-nav-link.active {
        background: var(--sd-brand-soft);
    }

    .sd-topbar-right {
        flex-wrap: wrap;
        justify-content: space-between;
        padding: 12px 0 4px;
        margin-top: 8px;
        border-top: 1px solid var(--sd-border);
    }

    .sd-topbar .dropdown-menu.sd-menu {
        position: static;
        float: none;
        width: 100%;
        box-shadow: none;
    }
}

/* ---------- Buttons ---------- */
.sd-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none !important;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
}

    .sd-btn:disabled {
        cursor: not-allowed;
        opacity: .5;
    }

.sd-btn-primary,
.sd-btn-primary:focus {
    color: #fff;
    background: var(--sd-brand);
}

    .sd-btn-primary:hover:not(:disabled) {
        color: #fff;
        background: var(--sd-brand-dark);
    }

.sd-btn-ghost,
.sd-btn-ghost:focus {
    color: var(--sd-text);
    background: transparent;
    border-color: var(--sd-border);
}

    .sd-btn-ghost:hover {
        color: var(--sd-text);
        background: var(--sd-bg);
    }

.sd-btn-icon {
    justify-content: center;
    width: 38px;
    padding: 0;
}

.sd-btn-sm {
    height: 30px;
    padding: 0 10px;
    font-size: 13px;
}

    .sd-btn-sm.sd-btn-icon {
        width: 30px;
        padding: 0;
    }

/* ---------- Lizenzvertrag (SW-121): Dialog und eigene Seite ---------- */
#License {
    max-width: 960px;
    margin: 0 auto;
    padding: 8px 0 32px;
    color: var(--sd-text);
}

.sd-license-dialog {
    width: min(860px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: 0;
    color: var(--sd-text);
    background: var(--sd-surface);
    border: 0;
    border-radius: var(--sd-radius);
    box-shadow: var(--sd-shadow-lg);
}

    .sd-license-dialog::backdrop {
        background: rgba(16, 24, 40, .45);
    }

    .sd-license-dialog[open] .sd-license-dialog-form {
        display: flex;
        flex-direction: column;
        max-height: calc(100vh - 48px);
    }

.sd-license-card {
    color: var(--sd-text);
    background: var(--sd-surface);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    box-shadow: var(--sd-shadow);
}

.sd-license-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--sd-border);
}

    .sd-license-head h2 {
        margin: 0 0 4px;
        font-size: 18px;
        font-weight: 600;
    }

    .sd-license-head p {
        margin: 0;
        color: var(--sd-muted);
    }

.sd-license-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    color: var(--sd-brand);
    background: var(--sd-brand-soft);
    border-radius: 10px;
}

    .sd-license-icon .sd-i {
        width: 20px;
        height: 20px;
    }

.sd-license-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    margin-left: auto;
    padding: 0;
    color: var(--sd-muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
}

    .sd-license-close:hover {
        color: var(--sd-text);
        background: var(--sd-hover);
    }

.sd-license-text {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 55vh;
    overflow-y: auto;
    padding: 16px 24px;
    font-size: 13px;
    line-height: 1.6;
    background: var(--sd-bg);
}

    .sd-license-text:focus-visible {
        outline: 2px solid var(--sd-brand);
        outline-offset: -2px;
    }

.sd-license-text-full {
    max-height: none;
    border-radius: var(--sd-radius);
}

.sd-license-doc h5 {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
}

.sd-license-doc ol {
    margin: 12px 0;
    padding-left: 28px;
}

    .sd-license-doc ol li {
        margin-bottom: 12px;
    }

    .sd-license-doc ol ol {
        margin: 6px 0;
        padding-left: 20px;
    }

        .sd-license-doc ol ol li {
            margin-bottom: 2px;
        }

.sd-license-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 16px 24px;
    border-top: 1px solid var(--sd-border);
}

.sd-license-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 500;
    cursor: pointer;
}

    .sd-license-check input {
        width: 16px;
        height: 16px;
        margin: 0;
    }

.sd-license-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}
