/* ---------------- THEME REFRESH ----------------
   Moderne Optik für App-Rahmen, Login, Karten, Formulare und Tabellen.
   Wird nach custom_standard.css geladen und überschreibt nur Optik, kein Layout.
   Belegdesigns (#billDiv, Quittungen) haben eigene Inline-Styles und sind nicht betroffen.
   Zum Zurücksetzen genügt es, die Zeile in index.html zu entfernen. */

:root {
    --app-bg: #F4F6FA;
    --app-surface: #FFFFFF;
    --app-surface-muted: #F8F9FC;
    --app-border: #E4E8F0;
    --app-border-strong: #D5DBE6;
    --app-text: #1B2333;
    --app-text-muted: #5E6A80;
    --app-primary: #1151F3;
    --app-primary-hover: #0B43D1;
    --app-primary-soft: #EAF0FE;
    --app-success: #009B51;
    --app-radius: 14px;
    --app-radius-sm: 10px;
    --app-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px rgba(16, 24, 40, 0.05);
    --app-shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.10);
    --app-font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Grundlage ---------- */
body {
    background-color: var(--app-bg);
    color: var(--app-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.rz-layout, .login-page {
    font-family: var(--app-font);
}

.background, .rz-body {
    background-color: var(--app-bg);
}

.text1 {
    color: var(--app-text);
}

/* ---------- Kopfzeile ---------- */
.rz-header.background, .rz-header {
    background-color: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--app-border) !important;
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .app-header-brand img {
        height: 26px;
        width: auto;
        margin-left: 4px;
    }

.app-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 12px;
}

    .app-header-user .rz-text-h6 {
        margin: 0;
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--app-text);
    }

.app-header-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--app-text-muted);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

    .app-header-logout:hover {
        background-color: var(--app-primary-soft);
        color: var(--app-primary);
    }

.rz-sidebar-toggle {
    background-color: transparent !important;
    color: var(--app-text) !important;
    border-radius: var(--app-radius-sm) !important;
}

    .rz-sidebar-toggle:hover {
        background-color: var(--app-primary-soft) !important;
        color: var(--app-primary) !important;
    }

/* ---------- Seitenleiste ---------- */
.rz-sidebar, .rz-sidebar.background {
    background-color: var(--app-surface) !important;
    border-right: 1px solid var(--app-border) !important;
}

    .rz-sidebar .rz-panel-menu.element1 {
        background-color: transparent;
        border-radius: 0;
        margin: 12px 10px !important;
        width: auto !important;
    }

.rz-navigation-item {
    margin-bottom: 2px;
}

.rz-navigation-item-link {
    background-color: transparent;
    border-radius: var(--app-radius-sm);
    padding-top: 10px;
    padding-bottom: 10px;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}

    .rz-navigation-item-link:hover {
        background-color: var(--app-primary-soft);
        color: var(--app-primary);
    }

        .rz-navigation-item-link:hover .rz-navigation-item-icon,
        .rz-navigation-item-link:hover .rz-navigation-item-text {
            color: var(--app-primary);
        }

.rz-navigation-item-wrapper {
    color: var(--app-text) !important;
}

.rz-navigation-item-icon {
    color: var(--app-text-muted);
}

/* ---------- Karten ---------- */
.rz-card {
    background-color: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
}

.element1 {
    background-color: var(--app-surface-muted);
}

.element2 {
    background-color: #EEF1F6;
}

/* ---------- Buttons ---------- */
.rz-button {
    border-radius: var(--app-radius-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: none;
    transition: background-color .15s ease, box-shadow .15s ease, transform .05s ease;
}

    .rz-button:not(.rz-state-disabled):active {
        transform: translateY(1px);
    }

    .rz-button.rz-primary.rz-shade-default,
    .rz-button.rz-primary.rz-variant-filled {
        background-color: var(--app-primary);
    }

        .rz-button.rz-primary.rz-shade-default:not(.rz-state-disabled):hover {
            background-color: var(--app-primary-hover);
            box-shadow: 0 4px 12px rgba(17, 81, 243, 0.25);
        }

    .rz-button.rz-success.rz-shade-default:not(.rz-state-disabled):hover {
        box-shadow: 0 4px 12px rgba(0, 155, 81, 0.25);
    }

    .rz-button.rz-light {
        background-color: var(--app-surface);
        border: 1px solid var(--app-border-strong);
        color: var(--app-text);
    }

        .rz-button.rz-light:not(.rz-state-disabled):hover {
            background-color: var(--app-surface-muted);
        }

/* ---------- Formulare ---------- */
.rz-form-field-content {
    background-color: var(--app-surface);
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.rz-form-field:focus-within .rz-form-field-content {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(17, 81, 243, 0.12);
}

.rz-colorpicker, .rz-lookup-search input, .rz-spinner, .rz-calendar .rz-inputtext, .rz-multiselect, .rz-dropdown, .mask, .rz-textarea, .rz-textbox {
    background-color: var(--app-surface);
    color: var(--app-text);
    border-radius: var(--app-radius-sm);
}

    .rz-textbox:focus, .rz-textarea:focus, .rz-dropdown:focus-within, .rz-spinner:focus-within, .rz-multiselect:focus-within {
        border-color: var(--app-primary);
        box-shadow: 0 0 0 3px rgba(17, 81, 243, 0.12);
    }

.rz-text-body1 {
    color: var(--app-text);
}

/* ---------- Tabellen ---------- */
.rz-datatable, .rz-data-grid {
    background-color: var(--app-surface);
    color: var(--app-text);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    overflow: hidden;
    box-shadow: var(--app-shadow);
}

.rz-datatable-thead th, .rz-grid-table thead th,
.rz-grid-table-fixed .rz-frozen-cell-left, .rz-grid-table-fixed .rz-frozen-cell-right,
.rz-grid-table-fixed .rz-frozen-cell-left-inner, .rz-grid-table-fixed .rz-frozen-cell-right-inner,
.rz-cell-filter {
    background-color: var(--app-surface-muted);
    border-color: var(--app-border);
}

    .rz-datatable-thead th .rz-column-title, .rz-grid-table thead th .rz-column-title {
        color: var(--app-text-muted);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        letter-spacing: 0.04em;
        border-color: var(--app-border);
    }

.rz-datatable-thead th:not(:last-child), .rz-grid-table thead th:not(:last-child) {
    border-color: var(--app-border);
}

.rz-grid-table td {
    background-color: var(--app-surface);
    border-color: var(--app-border);
}

.rz-grid-table-striped tbody > tr:not(.rz-expanded-row-content):nth-child(odd) > td {
    background-color: var(--app-surface-muted);
    border-color: var(--app-border);
}

.rz-grid-table tbody > tr.rz-data-row:hover > td {
    background-color: var(--app-primary-soft);
}

.rz-grid-table-fixed .rz-frozen-cell-left.rz-frozen-cell-left-end {
    border-right-color: var(--app-border) !important;
}

/* ---------- Dialoge und Popups ---------- */
.rz-dialog, .rz-dialog-titlebar {
    background-color: var(--app-surface);
}

.rz-dialog {
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-lg);
}

.rz-dialog-title {
    color: var(--app-text);
    font-weight: 600;
}

.rz-html-editor-dropdown-items, .rz-splitbutton-menu, .rz-autocomplete-panel, .rz-multiselect-panel, .rz-dropdown-panel {
    background-color: var(--app-surface);
    color: var(--app-text);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    box-shadow: var(--app-shadow-lg);
}

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(17, 81, 243, 0.12), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(18, 164, 245, 0.12), transparent 60%),
        var(--app-bg);
}

.login-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
}

    .login-topbar img {
        height: 30px;
        width: auto;
    }

    .login-topbar a {
        color: var(--app-text-muted);
        text-decoration: none;
        font-weight: 500;
        font-size: 0.9rem;
    }

        .login-topbar a:hover {
            color: var(--app-primary);
        }

.login-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 64px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 18px;
    box-shadow: var(--app-shadow-lg);
    padding: 36px 32px 28px;
    position: relative;
    overflow: hidden;
}

    .login-card::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 4px;
        background: linear-gradient(90deg, var(--app-primary), #12A4F5);
    }

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

    .login-logo img {
        width: 150px;
        height: auto;
    }

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--app-text);
    margin: 0 0 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--app-text-muted);
    font-size: 0.95rem;
    margin: 0 0 24px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 6px;
}

.login-form .rz-textbox, .login-form .rz-password input, .login-form input.rz-textbox {
    height: 46px;
    width: 100%;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    background-color: var(--app-surface);
    padding: 0 14px;
}

.login-form .rz-button {
    height: 46px;
    width: 100%;
    font-size: 1rem;
}

.login-forgot {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

    .login-forgot .rz-button {
        height: auto;
        width: auto;
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--app-text-muted);
        background: transparent;
        border: none;
    }

        .login-forgot .rz-button:hover {
            color: var(--app-primary);
            background: transparent !important;
            box-shadow: none !important;
        }

.login-footer {
    text-align: center;
    color: var(--app-text-muted);
    font-size: 0.8rem;
    padding: 0 16px 24px;
}

/* ---------- Abgelaufene Sitzung ---------- */
.session-expired {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: var(--app-font);
}

    .session-expired .login-card {
        text-align: center;
    }

@media (max-width: 512px) {
    .login-card {
        padding: 28px 20px 22px;
        border-radius: 14px;
    }

    .login-topbar {
        padding: 14px 16px;
    }
}

/* ================= Runde 2: Seiten, Dashboard, Badges ================= */

/* ---------- Seitentitel und Abschnitte ---------- */
.rz-body {
    padding: 8px 4px 32px;
}

.rz-body .rz-text-h3, .rz-body .rz-text-h4 {
    font-family: var(--app-font);
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--app-text) !important;
}

.rz-body .rz-text-h3 {
    font-size: 1.75rem;
}

.rz-body .rz-text-h4 {
    font-size: 1.4rem;
}

.rz-body .rz-text-h5, .rz-body .rz-text-h6 {
    font-weight: 600;
    color: var(--app-text);
}

.rz-body .rz-text-subtitle2 {
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 4px;
}

.app-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 2vw 0;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.page-title {
    font-family: var(--app-font);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--app-text);
    margin: 0;
}

.page-subtitle {
    color: var(--app-text-muted);
    margin: 4px 0 0;
    font-size: 0.98rem;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title {
    font-family: var(--app-font);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--app-text);
    margin: 0;
}

.section-meta {
    color: var(--app-text-muted);
    font-size: 0.85rem;
}

.empty-hint {
    padding: 28px 16px;
    text-align: center;
    color: var(--app-text-muted);
    background-color: var(--app-surface-muted);
    border: 1px dashed var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    font-size: 0.92rem;
}

/* ---------- Schnellaktionen ---------- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px;
    text-align: left;
    background-color: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
    cursor: pointer;
    font-family: var(--app-font);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

    .quick-action:hover {
        transform: translateY(-2px);
        border-color: var(--app-border-strong);
        box-shadow: var(--app-shadow-lg);
    }

    .quick-action:focus-visible {
        outline: 3px solid rgba(17, 81, 243, 0.3);
        outline-offset: 2px;
    }

.quick-action-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
}

    .quick-action-icon .rzi, .quick-action-icon i {
        font-size: 24px;
    }

.qa-blue { background-color: #EAF0FE; color: #1151F3; }
.qa-green { background-color: #E6F6EE; color: #009B51; }
.qa-orange { background-color: #FFF4E0; color: #C27C00; }
.qa-gray { background-color: #EEF1F6; color: #3D4A60; }

.quick-action-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.quick-action-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--app-text);
}

.quick-action-sub {
    font-size: 0.85rem;
    color: var(--app-text-muted);
}

/* ---------- Suchfeld ---------- */
.search-field {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 46px;
    padding: 0 14px;
    margin-bottom: 14px;
    background-color: var(--app-surface);
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}

    .search-field:focus-within {
        border-color: var(--app-primary);
        box-shadow: 0 0 0 3px rgba(17, 81, 243, 0.12);
    }

    .search-field .rzi, .search-field i {
        color: var(--app-text-muted);
    }

    .search-field input {
        flex: 1;
        border: none;
        outline: none;
        background: transparent;
        font-size: 0.95rem;
        color: var(--app-text);
        font-family: var(--app-font);
    }

/* ---------- Badges ---------- */
.rz-badge {
    border-radius: 999px;
    padding: 3px 10px;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    text-transform: none;
}

    .rz-badge.rz-badge-primary { background-color: #EAF0FE; color: #1151F3; }
    .rz-badge.rz-badge-success { background-color: #E6F6EE; color: #007A40; }
    .rz-badge.rz-badge-warning { background-color: #FFF4E0; color: #A66A00; }
    .rz-badge.rz-badge-danger { background-color: #FDE8EE; color: #C4103F; }
    .rz-badge.rz-badge-info { background-color: #E5F5FE; color: #0B7DBF; }

/* ---------- Pager ---------- */
.rz-pager {
    background-color: transparent;
    border-top: 1px solid var(--app-border);
}

    .rz-pager .rz-pager-page, .rz-pager .rz-pager-element {
        border-radius: 8px;
    }

    .rz-pager .rz-pager-page.rz-state-active {
        background-color: var(--app-primary);
        color: #FFFFFF;
    }

/* ---------- Scrollbalken ---------- */
.rz-body ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.rz-body ::-webkit-scrollbar-thumb {
    background-color: #CBD2DE;
    border-radius: 10px;
    border: 2px solid var(--app-bg);
}

.rz-body ::-webkit-scrollbar-track {
    background: transparent;
}

/* ---------- Ladebildschirm ---------- */
#app > div:has(> .loader) {
    background-color: var(--app-bg);
    gap: 24px;
}

/* ================= Runde 3: BillBuilder, Suchergebnisse ================= */

.result-header {
    margin-top: 18px;
    margin-bottom: 10px;
}

/* ---------- BillBuilder ---------- */
.bb-page {
    padding-bottom: 96px;
}

.bb-header-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bb-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

    .bb-layout > .rz-card {
        width: 100% !important;
        padding: 22px 24px;
    }

    .bb-layout .rz-card .rz-card {
        box-shadow: none;
        background-color: var(--app-surface-muted);
    }

    .bb-layout .rz-text-h5 {
        font-size: 1.05rem;
        font-weight: 600;
        margin: 0 0 14px !important;
        color: var(--app-text) !important;
    }

.bb-general {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

    .bb-general .rz-textarea {
        width: 100%;
        min-height: 90px;
    }

.bb-group-title {
    font-family: var(--app-font);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--app-text);
    margin: 22px 0 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--app-border);
}

/* Aktionsleiste unten, bleibt beim Scrollen sichtbar */
.bb-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 14px 18px;
    background-color: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: 0 -6px 24px rgba(16, 24, 40, 0.08);
}

    .bb-actions a {
        text-decoration: none;
    }

    .bb-actions .rz-button {
        white-space: nowrap;
    }

.bb-actions-spacer {
    flex: 1;
}

.bb-loading {
    height: 4px;
    border-radius: 4px;
    overflow: hidden;
}

@media (max-width: 640px) {
    .bb-layout > .rz-card {
        padding: 16px;
    }

    .bb-actions {
        padding: 10px;
    }
}

/* ================= Runde 4: Größere Schrift am Desktop =================
   Radzen skaliert Buttons, Felder, Tabellen und Texte über --rz-root-font-size.
   Mobil bleibt es bei 13.5px (custom_standard.css), am Desktop wird alles größer. */
@media (min-width: 1024px) {
    :root {
        --rz-root-font-size: 15px;
    }
}

@media (min-width: 1600px) {
    :root {
        --rz-root-font-size: 16px;
    }
}

@media (min-width: 1024px) {
    .rz-header {
        min-height: 60px;
    }

    .app-header-brand img {
        height: 30px;
    }

    .rz-navigation-item-link {
        font-size: 1rem;
    }

    .rz-grid-table td, .rz-datatable-data td .rz-cell-data, .rz-grid-table td .rz-cell-data {
        font-size: 0.95rem;
    }
}

/* ================= Runde 5: Anrede-Buttons, Tabellen mit automatischer Breite ================= */
.salutation-toggle {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

    .salutation-toggle .rz-button {
        min-width: 96px;
        padding: 0 18px;
        font-size: 0.95rem;
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

        .salutation-toggle .rz-button .rz-button-text {
            overflow: visible;
            text-overflow: clip;
        }

/* Spaltenbreite richtet sich nach dem Inhalt; auf schmalen Bildschirmen wird quer gescrollt */
.auto-grid .rz-data-grid-data {
    overflow-x: auto;
}

.auto-grid .rz-grid-table {
    table-layout: auto !important;
    width: 100% !important;
    min-width: 0 !important;
}

    .auto-grid .rz-grid-table col {
        width: auto !important;
    }

    .auto-grid .rz-grid-table th,
    .auto-grid .rz-grid-table td {
        white-space: nowrap;
        width: auto !important;
    }

        .auto-grid .rz-grid-table td .rz-cell-data {
            overflow: visible;
            text-overflow: clip;
        }

@media (max-width: 640px) {
    .auto-grid .rz-grid-table th,
    .auto-grid .rz-grid-table td {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* ================= Runde 6: Felder im BillBuilder, Einstellungen ================= */

/* ---------- Gemeinsame Formularfelder ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px 18px;
    align-items: start;
}

    .form-grid > .full,
    .form-grid > .rz-alert {
        grid-column: 1 / -1;
    }

    .form-grid .rz-text-subtitle2,
    .bb-field .rz-text-subtitle2,
    .settings-card .rz-text-subtitle2 {
        font-size: 0.82rem !important;
        font-weight: 600 !important;
        color: var(--app-text-muted) !important;
        margin: 0 0 6px !important;
        text-transform: none;
        letter-spacing: 0.01em;
    }

.form-grid .rz-textbox, .form-grid .rz-numeric, .form-grid .rz-password, .form-grid .rz-textarea, .form-grid .rz-dropdown,
.bb-field .rz-textbox, .bb-field .rz-numeric, .bb-field .rz-dropdown, .bb-field .rz-dropdown-datagrid, .bb-field .rz-multiselect {
    width: 100% !important;
    max-width: none !important;
}

.rz-textbox, .rz-numeric, .rz-dropdown, .rz-password, .rz-multiselect {
    min-height: 40px;
    border: 1px solid var(--app-border-strong);
}

.rz-textbox, .rz-numeric input, .rz-password input {
    padding-left: 12px;
    padding-right: 12px;
}

.rz-textarea {
    border: 1px solid var(--app-border-strong);
    padding: 10px 12px;
    line-height: 1.45;
}

.rz-textbox:hover, .rz-numeric:hover, .rz-dropdown:hover, .rz-password:hover, .rz-textarea:hover, .rz-multiselect:hover {
    border-color: #B9C2D3;
}

.rz-chkbox-box {
    border-radius: 6px;
}

    .rz-chkbox-box.rz-state-active {
        background-color: var(--app-primary);
        border-color: var(--app-primary);
    }

/* ---------- BillBuilder: Vorlagenfelder im Raster ---------- */
.bb-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px 20px;
    align-items: start;
}

    .bb-fields > .rz-text-h5,
    .bb-fields > .bb-group-title,
    .bb-fields > p,
    .bb-fields > div:not(.bb-field) {
        grid-column: 1 / -1;
    }

    .bb-fields > .bb-group-title:first-of-type {
        margin-top: 0;
    }

.bb-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

    .bb-field:not(:has(*)) {
        display: none;
    }

    /* Checkbox mit Beschriftung */
    .bb-field > div[style*="flex-direction:row"],
    .bb-field div[style*="flrex-direction:row"] {
        align-items: center;
        min-height: 40px;
        padding: 0 12px;
        border: 1px solid var(--app-border);
        border-radius: var(--app-radius-sm);
        background-color: var(--app-surface);
    }

        .bb-field > div[style*="flex-direction:row"] .rz-text-subtitle2 {
            margin: 0 !important;
            color: var(--app-text) !important;
            font-size: 0.9rem !important;
        }

    .bb-field > div[style*="margin-top:10px"] {
        margin-top: 0 !important;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .bb-field .rz-text-subtitle1 {
        font-weight: 600;
        color: var(--app-primary);
        background-color: var(--app-primary-soft);
        border-radius: var(--app-radius-sm);
        padding: 10px 12px;
        margin: 0;
    }

/* Leistungen der Offerte als Kacheln */
.bb-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

    .bb-check-grid > div {
        display: flex;
        align-items: center;
        gap: 4px;
        min-height: 44px;
        padding: 0 12px;
        border: 1px solid var(--app-border);
        border-radius: var(--app-radius-sm);
        background-color: var(--app-surface);
        transition: border-color .15s ease, background-color .15s ease;
    }

        .bb-check-grid > div:has(.rz-state-active) {
            border-color: var(--app-primary);
            background-color: var(--app-primary-soft);
        }

        .bb-check-grid > div .rz-label {
            cursor: pointer;
            font-weight: 500;
        }

/* ---------- Einstellungen ---------- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
    align-items: start;
}

.settings-wide {
    grid-column: 1 / -1;
}

.settings-slot {
    display: contents;
}

.settings-card {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 22px 24px !important;
}

    .settings-card .rz-text-h5 {
        font-size: 1.1rem;
        font-weight: 600;
        margin: 0 0 4px !important;
        color: var(--app-text) !important;
    }

    .settings-card .rz-text-h6 {
        font-size: 0.98rem;
        font-weight: 600;
        margin: 0 0 12px !important;
    }

.settings-hint {
    color: var(--app-text-muted);
    font-size: 0.88rem;
    margin: 0 0 16px;
}

.settings-subcard {
    padding: 18px;
    margin-bottom: 18px;
    background-color: var(--app-surface-muted);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

@media (max-width: 640px) {
    .settings-card {
        padding: 16px !important;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* ================= Runde 7: Belegvorschau am Handy ================= */
.bill-preview-viewport {
    width: 100%;
    overflow-x: hidden;
}

.bill-preview-scale {
    width: max-content;
    max-width: none;
}

/* ================= Runde 8: Aktionsleiste im BillBuilder am Handy ================= */
@media (max-width: 640px) {
    /* Am Handy nicht mehr über dem Inhalt schweben, sondern am Ende der Seite stehen */
    .bb-page {
        padding-bottom: 24px;
    }

    .bb-actions {
        position: static;
        gap: 6px;
        padding: 10px;
        margin-top: 14px;
        border-radius: var(--app-radius-sm);
        box-shadow: var(--app-shadow);
    }

        .bb-actions .rz-button {
            min-height: 34px;
            padding: 0 10px;
            font-size: 0.82rem;
        }

        .bb-actions .rz-button .rzi,
        .bb-actions .rz-button i {
            font-size: 1.05rem;
        }

    .bb-actions-spacer {
        display: none;
    }
}

/* ================= Runde 9: Mailversand im Hintergrund ================= */
.mail-status-pill {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 40px);
    padding: 10px 14px;
    background-color: #1B2333;
    color: #FFFFFF;
    border-radius: 999px;
    box-shadow: var(--app-shadow-lg);
    font-family: var(--app-font);
    font-size: 0.88rem;
    font-weight: 500;
}

.mail-status-spinner {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: mail-status-spin 0.8s linear infinite;
}

@keyframes mail-status-spin {
    to {
        transform: rotate(360deg);
    }
}
