:root {
    --spacing: 8px;
    --spacing-0-5: calc(var(--spacing) / 2);
    --spacing-1: var(--spacing);
    --spacing-1-5: calc(var(--spacing) * 1.5);
    --spacing-2: calc(var(--spacing) * 2);
    --spacing-3: calc(var(--spacing) * 3);
    --spacing-4: calc(var(--spacing) * 4);
    --spacing-5: calc(var(--spacing) * 5);
    --spacing-6: calc(var(--spacing) * 6);
    --spacing-6-5: calc(var(--spacing) * 6.5);
    --spacing-8: calc(var(--spacing) * 8);
    --spacing-9: calc(var(--spacing) * 9);
    --spacing-fixed-bottom: var(--spacing-9);

    --prompt-width: calc(var(--spacing) * 50);

    --dsw-color:  rgb(42, 168, 52);
    --dsw-color2: rgb(42, 168, 52);
    --dsw-color3: rgb(0, 128, 153);

    /* ── Konsistente Seitenbreiten ──────────────────────────
       Alle Content-Seiten nutzen --page-max.
       Tabellen-Seiten (invoice_preview etc.) brauchen keinen
       max-width-Wrapper — die table-wrapper kümmert sich selbst.
    ─────────────────────────────────────────────────────── */
    --page-max:      1100px;   /* Standard für alle Content-Seiten    */
    --page-max-wide: 1300px;   /* Dashboard, breite Layouts            */
}

/* ── Universeller Seiten-Wrapper ────────────────────────────
   Ersetzen der individuellen .setup-page, .selection-page,
   .create-page, .dash-page etc.
─────────────────────────────────────────────────────────── */
.page-wrap {
    max-width: var(--page-max);
    margin: 0 auto;
    padding-bottom: 80px;
}
.page-wrap--wide {
    max-width: var(--page-max-wide);
    margin: 0 auto;
    padding-bottom: 80px;
}

html, body {
}

body #bodywrapper.loaded {
    opacity: 1 !important;
    visibility: visible !important;
}

.main {
    padding-top: 48px;
    min-height: 100dvh;
}

nav .w3-bar-block {
    min-height: calc(100vh - 86px);
}

.dsw-header-mobil {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Vertikal zentrieren */
    padding: 10px; /* Falls nötig, für Abstand */
}

.page-title {
    padding-bottom: 48px;
}

.page-title h2 {

}

.section{
    background-color: #fafafa;
    padding: 8px 8px 16px 8px;
    margin: 16px 0;
}

.section > p {
    font-weight: bold;
}

/**
BUTTONS
 */

button.w3-button {
    background-color: silver;
}

.save-btn{
    text-align: center;
    display: block;
    width: 180px;
    float: right;
}

/**
ICONS
 */
i.fa {
    padding-left: 8px;
}

/***
FORM INPUT ETC
 */
.icon-input-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.icon-input-icon {
    width: 80px;
    text-align: center;
}

.icon-input-icon i {
    color: rgb(42, 168, 52);
}

.icon-input-input {
    flex: 1;
    background-color: #f1f1f1;
    padding: 8px;
}

.icon-input-input label {
    font-weight: bold;
}

.icon-input-input select {
    background-color: #fff;
    padding: 8px;
}

.input-wrapper {
    position: relative;
    margin-top: 1.5rem;
}

.input-wrapper input, .input-wrapper textarea {
    width: 100%;
    padding: 12px 8px 12px 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.input-wrapper label {
    position: absolute;
    left: 3px;
    top: 12px;
    background: white;
    padding: 0 4px;
    color: #999;
    font-size: 12px;
    transition: 0.2s ease all;
    pointer-events: none;
    white-space: nowrap;

}

.input-wrapper.focus > label,
.input-wrapper input:not(:placeholder-shown) + label,
.input-wrapper textarea:not(:placeholder-shown) + label {
    top: -18px;
    left: 0;
    font-size: 12px;
    color: #2196F3;
    background-color: transparent;
}

.input-wrapper textarea {
    font-size: 14px;
    min-height: 250px;
}

/**
LAYOUT
 */
.layout {
    min-height: 100dvh;
    display: flex;
    align-items: stretch;
}

.layout__body {
    flex: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.layout__widget {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}


/**
CARD
 */

.card {
    border-radius: 5px;
}

.login-card {

}

.card > main {
    height: 100%;
}

.card section {
    width: var(--prompt-width);
}

.card section header {
    padding: var(--spacing-5) var(--spacing-5) var(--spacing-3);
}

.card section header .prompt-logo {
    width: auto !important;
    height: 80px !important;
    position: static !important;
    margin: auto !important;
    padding: 0 !important;
    background-color: transparent !important;
    background-position: center !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-image: url("/public/assets/images/DSW_Logo_re_rgb_1500px.png");
}

.card .card-content {
    padding: 0 var(--spacing-5) var(--spacing-5);
}

/***
BREADCRUMB
 */
/* ── Breadcrumb ─────────────────────────────────────────────── */
.bc-nav {
    background: #f4f6f7;
    border-bottom: 1px solid #e4e8ea;
    padding: 0 16px;
    margin-bottom: 0;
}

.bc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 38px;
    gap: 0;
}

.bc-item {
    display: flex;
    align-items: center;
    font-size: 12px;
}

/* Trennzeichen als CSS-Pseudoelement */
.bc-item + .bc-item::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-right: 1.5px solid #bbb;
    border-top: 1.5px solid #bbb;
    transform: rotate(45deg);
    margin: 0 10px;
    flex-shrink: 0;
}

.bc-link {
    text-decoration: none;
    color: rgb(0, 128, 153);
    padding: 8px 4px;
    border-radius: 3px;
    transition: color .15s;
    white-space: nowrap;
}
.bc-link i { margin-right: 4px; font-size: 11px; opacity: .8; }
.bc-link:hover { color: rgb(0, 100, 122); text-decoration: underline; }

.bc-current .bc-label {
    color: #444;
    font-weight: 600;
    padding: 8px 4px;
    white-space: nowrap;
}
.bc-current .bc-label i { margin-right: 4px; font-size: 11px; color: rgb(0,128,153); }

/**
FIXED SUBMENU
 */
.fixed + form, .fixed + .page_invoice, .fixed + .table-wrapper {
    padding-bottom: var(--spacing-fixed-bottom);
}

.fixed {
    position: fixed;
    z-index: 1;
    width: calc(100% - 380px);
    background-color: white;
    padding: var(--spacing-2) var(--spacing-1);;
}

.fixed button {
    margin: 0 !important;
}

.fixed.bottom {
    bottom: 0;
}

/**
TABLE
 */

.table-wrapper {
    height: calc(100vh - 280px);
}

table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 2;
    background: black;
}

table thead th {
    position: relative;
    border: 1px solid black;
    background-color: #3a3a3a;
    z-index: 4;
    color: white;
}

.table-search-bar {
    background-color: #3a3a3a;
    color: white;
}

/**
USABILITY ANIMATIONS LOADING ANIMATIONS
 */

.qanda-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
    margin: auto;
}

.tooltip-a {

}

.tooltip-q {
    font-weight: bold;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.context-menu {
    display: none;
    position: absolute;
    z-index: 5;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    min-width: 120px;
}

.context-menu button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
}

.context-menu button:hover {
    background: #f0f0f0;
}

.context-menu i {
    margin-right: 8px;
}

/** INVOICE OVERLAY IN TABLE TO VIEW PDF
 */
#invoiceOverlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 10;
    padding: 0;
}

#invoiceOverlay > button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 11;
}

#invoiceIframe {
    width: 100%;
    height: 100vh;
    border: none;
}

#tableBlocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.6); /* leichtes Weiß */
    z-index: 9; /* unterhalb des Overlays, aber über der Tabelle */
    display: none;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

#invoiceOverlay.show {
    animation: slideInRight 0.3s ease-out forwards;
}

#invoiceOverlay.hide {
    animation: slideOutRight 0.3s ease-in forwards;
}

/** LOADER ANIMATION **
 */
/* HTML: <div class="loader"></div> */
.loader {
    height: 4px;
    width: 130px;
    --c: no-repeat linear-gradient(#6100ee 0 0);
    background: var(--c), var(--c), #d7b8fc;
    background-size: 60% 100%;
    animation: l16 3s infinite;
}

.loader-large {
    width: 45px;
    animation: l6-large 1s infinite linear alternate;
}

.loader-center {
    margin: 0 auto;
    position: relative;
    top: 50vh;
}

.loader-show {
    display: block;
}

.loader-hide {
    display: none;
}

button .loader {
    top: 0;
    margin: 8px 8px;
}


@keyframes l16 {
    0% {
        background-position: -150% 0, -150% 0
    }
    66% {
        background-position: 250% 0, -150% 0
    }
    100% {
        background-position: 250% 0, 250% 0
    }
}


/* FETCH PROGRESS OVERLAY */

#fetchProgressOverlay {
    position: fixed;
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 10;
    padding: 0;
    overflow-y: scroll;
}
#fetchProgressOverlay.show {
    animation: slideInRight 0.3s ease-out forwards;
}

#fetchProgressOverlay.hide {
    animation: slideOutRight 0.3s ease-in forwards;
}
#fetchObject div {
    margin-bottom: 8px;
    font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════════════
   PROCESSING OVERLAY — genutzt von form_data_display.php
   ═══════════════════════════════════════════════════════════════ */
.processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.processing-modal {
    background: #fff;
    padding: 2rem 3rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    text-align: center;
    max-width: 400px;
    margin: calc(25% - 295px) auto;
}
.processing-modal h2 { margin-top: 0; margin-bottom: .5rem; }
.spinner {
    margin: 1.5rem auto 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 4px solid #ddd;
    border-top-color: rgb(0,128,153);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   FIELD-GROUP — Formularfelder, genutzt von invoice_setup.php
   und allen Formularen mit einheitlichem Label/Input-Muster
   ═══════════════════════════════════════════════════════════════ */
.field-grid { display: grid; gap: 16px; }
.field-grid.cols-1 { grid-template-columns: 1fr; }
.field-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.field-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) {
    .field-grid.cols-2,
    .field-grid.cols-3 { grid-template-columns: 1fr; }
}

.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.field-group label .req { color: rgb(186,70,19); margin-left: 2px; }
.field-group input,
.field-group select,
.field-group textarea {
    padding: 9px 12px;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    color: #222;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    box-sizing: border-box;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: rgb(0,128,153);
    box-shadow: 0 0 0 3px rgba(0,128,153,.1);
}
.field-group input[readonly] { background: #f8f9fa; cursor: pointer; }
.field-group input[readonly]:hover { border-color: rgb(0,128,153); }
.field-hint { font-size: 11px; color: #aaa; margin-top: 2px; }

/* Datum-Input mit Icon */
.date-input-wrapper { position: relative; }
.date-input-wrapper input { padding-right: 36px; }
.date-input-wrapper .date-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   SETUP-CARD — Sektionskarten, genutzt von invoice_setup.php
   ═══════════════════════════════════════════════════════════════ */
.setup-page {
    padding-bottom: 100px;
}
.setup-header { margin-bottom: 32px; }
.setup-header h2 { margin: 0 0 4px 0; font-size: 22px; color: #1a1a1a; }
.setup-header .form-name {
    font-size: 13px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
}
.setup-header .form-name i { color: rgb(0,128,153); }

.setup-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.setup-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e8e8e8;
}
.setup-card-header .card-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(0,128,153,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(0,128,153);
    font-size: 14px;
    flex-shrink: 0;
}
.setup-card-header h3 { margin: 0; font-size: 14px; font-weight: 700; color: #333; }
.setup-card-header p { margin: 2px 0 0; font-size: 12px; color: #888; }
.setup-card-body { padding: 20px; }

/* Submit-Leiste */
.setup-submit-bar {
    position: fixed;
    bottom: 0;
    left: 340px;
    right: 0;
    background: #fff;
    border-top: 2px solid rgb(0,128,153);
    padding: 12px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}
.setup-submit-bar .form-hint { font-size: 12px; color: #aaa; }
.setup-submit-bar .form-hint strong { color: #555; }
.btn-submit {
    padding: 10px 28px;
    background: rgb(0,128,153);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background .15s, transform .1s;
}
.btn-submit:hover { background: rgb(0,105,127); transform: translateY(-1px); }

/* KST-Block (Kostenstelle) */
#kst {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0,128,153,.05);
    border: 1px solid rgba(0,128,153,.2);
    border-radius: 5px;
}
#kst label {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .4px;
    display: block;
    margin-bottom: 5px;
}

/* ═══════════════════════════════════════════════════════════════
   DATE-PICKER MODAL — genutzt von invoice_setup.php
   und flexible_invoice_import.php
   ═══════════════════════════════════════════════════════════════ */
.date-modal-content { max-width: 440px; border-radius: 8px; overflow: hidden; }
.date-modal-header {
    background: rgb(0,128,153);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.date-modal-header h4 { margin: 0; font-size: 16px; }
.date-modal-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    opacity: .8;
}
.date-modal-header button:hover { opacity: 1; }
.date-modal-body { padding: 24px; }
.date-section { margin-bottom: 20px; }
.date-section-label {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
    display: block;
}
.date-or-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: #bbb;
    font-size: 12px;
}
.date-or-divider::before,
.date-or-divider::after { content: ''; flex: 1; height: 1px; background: #eee; }
.date-range-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.date-field label { font-size: 11px; font-weight: 600; color: #888; display: block; margin-bottom: 4px; }
.date-field input {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    box-sizing: border-box;
}
.date-field input:focus { outline: none; border-color: rgb(0,128,153); }
.date-modal-footer {
    padding: 16px 24px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.btn-date-cancel {
    padding: 8px 18px;
    background: #fff;
    border: 1.5px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
}
.btn-date-apply {
    padding: 8px 18px;
    background: rgb(0,128,153);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.btn-date-apply:hover { background: rgb(0,105,127); }