/* erp3dp – ergänzende Styles zu Bootstrap 5 */
:root {
    --erp-brand: #e8590c;
    --erp-topbar-height: 56px;
    --erp-sidebar-width: 264px;
    --erp-sidebar-group-bg: rgba(0, 0, 0, .04);
}

[data-bs-theme="dark"] {
    --erp-sidebar-group-bg: rgba(255, 255, 255, .06);
}

body {
    background-color: var(--bs-tertiary-bg);
    min-height: 100vh;
}

.navbar-brand .brand-mark {
    color: var(--erp-brand);
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.card {
    border: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .08);
}

.card-header {
    background-color: transparent;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.stat-card .stat-label {
    color: var(--bs-secondary-color);
    font-size: .85rem;
}

.color-swatch {
    display: inline-block;
    width: .9rem;
    height: .9rem;
    border-radius: 50%;
    border: 1px solid var(--bs-border-color);
    vertical-align: -.1rem;
    margin-right: .35rem;
}

.table td, .table th {
    vertical-align: middle;
}

.table-nowrap td, .table-nowrap th {
    white-space: nowrap;
}

.progress-thin {
    height: .5rem;
}

.printer-card .progress {
    height: .6rem;
}

dl.details dt {
    color: var(--bs-secondary-color);
    font-weight: 500;
}

dl.details dd {
    margin-bottom: .6rem;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card-wide {
    max-width: 680px;
}

.text-pre {
    white-space: pre-line;
}

@media print {
    .navbar, .app-sidebar, .app-footer, .btn, form, .no-print { display: none !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff; }
    .card { box-shadow: none; }
}

a.stat-card {
    color: inherit;
    transition: box-shadow .15s ease-in-out;
}

a.stat-card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1), 0 4px 12px rgba(0, 0, 0, .1);
}

/* Dunkles Farbschema */
[data-bs-theme="dark"] .card {
    box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .5);
}

[data-bs-theme="dark"] .navbar-brand .brand-mark {
    color: #ff7a2e;
}

/* Produktbilder */
.product-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: .375rem;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
}

.product-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
}

.product-main-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    border-radius: .5rem;
    background: var(--bs-tertiary-bg);
}

.product-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: .5rem;
}

.product-gallery figure {
    margin: 0;
    position: relative;
}

.product-gallery img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: .375rem;
    border: 2px solid transparent;
    cursor: pointer;
    background: var(--bs-tertiary-bg);
}

.product-gallery img.is-primary {
    border-color: var(--bs-primary);
}

/* ------------------------------------------------------------------
   Anwendungsrahmen: Kopfleiste oben, Navigation links nach Modulen
   ------------------------------------------------------------------ */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: var(--erp-topbar-height);
    padding-top: .25rem;
    padding-bottom: .25rem;
}

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - var(--erp-topbar-height));
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1440px;
    padding: 1.5rem 1.5rem 3rem;
}

.app-footer {
    padding: 0 1.5rem 1.5rem;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: var(--erp-topbar-height);
        flex: 0 0 var(--erp-sidebar-width);
        width: var(--erp-sidebar-width);
        height: calc(100vh - var(--erp-topbar-height));
        overflow-y: auto;
        background-color: var(--bs-body-bg);
        border-right: 1px solid var(--bs-border-color);
    }

    .app-sidebar .offcanvas-body {
        padding: 1rem .75rem 2rem;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        --bs-offcanvas-width: 280px;
    }

    .app-content {
        padding: 1rem 1rem 2.5rem;
    }

    .app-footer {
        padding: 0 1rem 1rem;
    }
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    font-size: .925rem;
}

.sidebar-nav .bi {
    width: 1.25rem;
    flex: 0 0 1.25rem;
    text-align: center;
}

.sidebar-toggle,
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .45rem .75rem;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    color: var(--bs-body-color);
    text-align: left;
    text-decoration: none;
}

.sidebar-toggle {
    font-weight: 600;
}

.sidebar-toggle:hover,
.sidebar-nav .nav-link:hover {
    background-color: var(--bs-tertiary-bg);
}

.sidebar-toggle:focus-visible,
.sidebar-nav .nav-link:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

.sidebar-chevron {
    margin-left: auto;
    font-size: .75rem;
    color: var(--bs-secondary-color);
    transition: transform .15s ease-in-out;
}

.sidebar-toggle.collapsed .sidebar-chevron {
    transform: rotate(-90deg);
}

.sidebar-module > .nav-link {
    font-weight: 600;
}

.sidebar-items .nav-link {
    padding-left: 2.6rem;
    color: var(--bs-secondary-color);
}

.sidebar-items .nav-link .bi {
    display: none;
}

/* Aktueller Mandant in der Kopfzeile (nur bei mehreren Mandanten) */
.tenant-badge {
    max-width: 18rem;
    padding: .15rem .6rem;
    border-radius: 1rem;
    background-color: var(--erp-sidebar-group-bg);
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Abschnitte innerhalb eines Moduls: Titel auf ganz leicht grauem Grund, Schrift wie die Modulzeilen */
.sidebar-group {
    margin: .35rem 0 .15rem;
    padding: .3rem .75rem .3rem 2.6rem;
    border-radius: .375rem;
    background-color: var(--erp-sidebar-group-bg);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--bs-body-color);
}

.sidebar-section + .sidebar-section {
    margin-top: .5rem;
}

.sidebar-nav .nav-link.active {
    background-color: rgba(232, 89, 12, .12);
    color: var(--erp-brand);
    font-weight: 600;
}

[data-bs-theme="dark"] .sidebar-nav .nav-link.active {
    background-color: rgba(255, 122, 46, .16);
    color: #ff7a2e;
}

.sidebar-module + .sidebar-module {
    margin-top: .1rem;
}
