/* Rechnungsmodul – Premium SaaS + Business-Dokumenten-Feeling */
.inv-page {
    min-height: 100vh;
    background: #f4f6f9;
    padding-bottom: 3rem;
}
.inv-page .main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3rem;
}
.inv-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.inv-hero h1 {
    margin: 0;
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: #0c1222;
    line-height: 1.2;
}
.inv-hero-lead {
    margin: 0.5rem 0 0;
    max-width: 34rem;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: #5c6578;
}
.inv-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0 1.2rem;
    border-radius: 12px;
    border: none;
    background: #0c1222;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(12, 18, 34, 0.1), 0 2px 8px rgba(12, 18, 34, 0.06);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.inv-btn-primary:hover {
    background: #1a2332;
    box-shadow: 0 2px 4px rgba(12, 18, 34, 0.12);
}
.inv-toolbar {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(12, 18, 34, 0.05);
    border: 1px solid rgba(12, 18, 34, 0.07);
}
.inv-toolbar input,
.inv-toolbar select {
    min-height: 40px;
    padding: 0 0.75rem;
    border: 1px solid #d8dee8;
    border-radius: 10px;
    font-size: 0.8125rem;
    min-width: 158px;
    background: #fff;
    color: #1e293b;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.inv-toolbar input:focus,
.inv-toolbar select:focus {
    outline: none;
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.25);
}
.inv-table-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(12, 18, 34, 0.06);
    border: 1px solid rgba(12, 18, 34, 0.06);
    overflow: visible;
}
.inv-table-card table {
    width: 100%;
    border-collapse: collapse;
}
.inv-table-card th,
.inv-table-card td {
    padding: 0.72rem 1rem;
    border-bottom: 1px solid #eef1f6;
    font-size: 0.8125rem;
    text-align: left;
    color: #334155;
}
.inv-table-card th {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.065em;
    color: #64748b;
    font-weight: 600;
    background: #f8fafc;
}
.inv-table-card tr:last-child td {
    border-bottom: none;
}
.inv-status {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.inv-s-DRAFT { background: #e8ecf1; color: #3d4a5c; }
.inv-s-SENT { background: #dbeafe; color: #1d4ed8; }
.inv-s-OVERDUE { background: #ffedd5; color: #c2410c; }
.inv-s-PAID { background: #d1fae5; color: #047857; }
.inv-s-VOID { background: #fee2e2; color: #991b1b; }

/* —— Modal: geführter Prozess —— */
.inv-modal-overlay.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1.25rem 0.75rem 2rem;
    overflow-y: auto;
}
.inv-create-sheet {
    max-width: 600px;
    width: 100%;
    border-radius: 18px;
    border: 1px solid rgba(12, 18, 34, 0.1);
    box-shadow: 0 20px 50px rgba(12, 18, 34, 0.14), 0 0 1px rgba(12, 18, 34, 0.08);
    background: #eef1f6;
    max-height: none;
}
.inv-create-sheet .modal-head {
    background: #fff;
    border-bottom: 1px solid #e8ecf2;
    padding: 1.125rem 1.35rem;
    border-radius: 18px 18px 0 0;
}
.inv-create-sheet .modal-head h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0c1222;
}
.inv-create-sheet .modal-head .btn {
    min-height: 38px;
    padding: 0 0.85rem;
    border-radius: 10px;
    border: 1px solid #d8dee8;
    background: #fff;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 500;
}
.inv-create-sheet .modal-head .btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.inv-sheet-body {
    padding: 1rem 1.125rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    counter-reset: inv-step;
}

/* Prozess-Schritte: dezente Nummer, klare Card */
.inv-sheet-body > .inv-card {
    position: relative;
    padding: 1rem 1.15rem 1.05rem 2.75rem;
    background: #fff;
    border-radius: 14px;
    border: 1px solid rgba(12, 18, 34, 0.07);
    box-shadow: 0 1px 3px rgba(12, 18, 34, 0.04);
}
.inv-sheet-body > .inv-card::before {
    counter-increment: inv-step;
    content: counter(inv-step);
    position: absolute;
    left: 0.95rem;
    top: 1.05rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.inv-sheet-body > .inv-summary-card::before {
    background: #e8ecf4;
    color: #334155;
}

.inv-card h3 {
    margin: 0 0 0.25rem;
    padding: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #3d4d66;
    line-height: 1.3;
}
.inv-card-lead {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #64748b;
    max-width: 42em;
}

.inv-field {
    margin-bottom: 0;
}
.inv-field label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.055em;
    color: #64748b;
    margin-bottom: 0.4rem;
}
.inv-field select,
.inv-field input[type="text"],
.inv-field input[type="number"],
.inv-field input[type="date"] {
    width: 100%;
    min-height: 44px;
    padding: 0 0.75rem;
    border: 1px solid #d1d9e4;
    border-radius: 10px;
    font-size: 0.875rem;
    background: #fff;
    color: #0f172a;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.inv-field select:hover,
.inv-field input:hover {
    border-color: #b8c4d4;
}
.inv-field select:focus,
.inv-field input:focus {
    outline: none;
    border-color: #64748b;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.2);
    background: #fff;
}
.inv-field input::placeholder {
    color: #94a3b8;
}

.inv-info-card {
    margin-top: 0.65rem;
    padding: 0.7rem 0.85rem;
    border-radius: 11px;
    background: #f8fafc;
    border: 1px solid #e8ecf2;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #334155;
}
.inv-info-card strong {
    color: #0c1222;
    font-weight: 600;
}
.inv-info-card .inv-muted {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #64748b;
}
.inv-warn {
    margin-top: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 0.8125rem;
    line-height: 1.45;
}

/* Positions-Zeilen als Cards (kein Tabellen-Look) */
#invLineItems {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.inv-line-card {
    background: #fafbfd;
    border: 1px solid #e4e9f0;
    border-radius: 12px;
    padding: 0.85rem 0.95rem 0.95rem;
    box-shadow: 0 1px 2px rgba(12, 18, 34, 0.03);
}
.inv-line-card-head {
    display: flex;
    align-items: flex-end;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}
.inv-line-card-head .inv-line-desc-wrap {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}
.inv-line-remove {
    flex-shrink: 0;
    align-self: flex-end;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    margin-bottom: 0.125rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    font-size: 1.35rem;
    line-height: 1;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}
.inv-line-remove:hover:not(:disabled) {
    color: #b91c1c;
    background: rgba(185, 28, 28, 0.08);
}
.inv-line-remove:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
.inv-line-remove:disabled {
    display: none;
}
.inv-line-grid {
    display: grid;
    grid-template-columns: minmax(72px, 0.9fr) minmax(100px, 1.1fr) minmax(100px, 1.2fr) minmax(108px, 1fr);
    gap: 0.55rem 0.65rem;
    align-items: end;
}
.inv-line-total-field .inv-line-line-total {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.75rem;
    border: 1px solid #e4e9f0;
    border-radius: 10px;
    background: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #0c1222;
    box-sizing: border-box;
}
.inv-line-total-field label {
    color: #64748b;
}
@media (max-width: 620px) {
    .inv-line-grid {
        grid-template-columns: 1fr 1fr;
    }
    .inv-line-total-field {
        grid-column: 1 / -1;
    }
}
@media (max-width: 400px) {
    .inv-line-grid {
        grid-template-columns: 1fr;
    }
}
.inv-btn-ghost {
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    border: 1px dashed #c5cdd8;
    background: transparent;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    margin-top: 0.15rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.inv-btn-ghost:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

/* MWST: ruhig, ausgewogen */
.inv-vat-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin-top: 0.15rem;
}
@media (min-width: 420px) {
    .inv-vat-row {
        grid-template-columns: minmax(0, 1.15fr) minmax(140px, 1fr);
        align-items: end;
        gap: 1rem 1.25rem;
    }
}
.inv-toggle {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 44px;
    padding: 0.15rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    user-select: none;
    line-height: 1.35;
}
.inv-toggle input {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    flex-shrink: 0;
    accent-color: #0c1222;
    border-radius: 4px;
}
.inv-vat-select-wrap {
    min-width: 0;
}
.inv-vat-select-wrap label {
    margin-bottom: 0.4rem;
}
.inv-vat-select-wrap .inv-field {
    margin: 0;
}

/* Vorschau / Summen – Vertrauens-Anker */
.inv-summary-card {
    background: linear-gradient(165deg, #fff 0%, #f6f8fc 55%, #eef2f9 100%);
    border: 1px solid #d8e0ec;
    box-shadow: 0 4px 14px rgba(12, 18, 34, 0.06);
}
.inv-summary {
    text-align: right;
    padding: 0.35rem 0.15rem 0.15rem;
}
.inv-sum-lbl {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    text-align: right;
}
.inv-summary-row {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 1.35rem;
    margin-bottom: 0.5rem;
    line-height: 1.35;
}
.inv-summary-row .inv-sum-val {
    min-width: 7.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #334155;
    letter-spacing: -0.015em;
    text-align: right;
}
.inv-summary-total {
    margin-top: 1.05rem;
    padding-top: 1.15rem;
    border-top: 1px solid #c5cdd8;
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 1.35rem;
}
.inv-sum-lbl-total {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: #64748b;
    padding-top: 0.2rem;
}
.inv-summary-total .inv-sum-val-total {
    min-width: 7.25rem;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    color: #0c1222;
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
    text-align: right;
}

.inv-form-errors {
    padding: 0.65rem 0.85rem;
    border-radius: 11px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 0.8125rem;
    line-height: 1.45;
}
.inv-form-errors:empty {
    display: none;
}

/* Aktionen: klare Priorität */
.inv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
    margin-top: 0.35rem;
    padding-top: 0.25rem;
}
.inv-actions .inv-btn-secondary {
    min-height: 42px;
    padding: 0 0.95rem;
    border-radius: 10px;
    border: 1px solid #d8dee8;
    background: #fff;
    color: #5c6578;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.inv-actions .inv-btn-secondary:hover {
    background: #f8fafc;
    border-color: #c5cdd8;
    color: #334155;
}
.inv-actions .inv-btn-primary {
    min-height: 44px;
    padding: 0 1.15rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(12, 18, 34, 0.15);
}
.inv-actions .inv-btn-primary:hover {
    box-shadow: 0 3px 12px rgba(12, 18, 34, 0.18);
}

.inv-details-more {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid #eef1f6;
    font-size: 0.8125rem;
    color: #64748b;
}
.inv-details-more summary {
    font-weight: 500;
    color: #475569;
}

.inv-net-hint {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0.35rem 0 0;
}

/* Toasts */
.inv-toast-root {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 10200;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    pointer-events: none;
}
.inv-toast {
    max-width: 320px;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    line-height: 1.45;
    box-shadow: 0 8px 30px rgba(12, 18, 34, 0.18);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: auto;
    background: #0c1222;
    color: #fff;
}
.inv-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.inv-toast--error {
    background: #7f1d1d;
}

/* —— PDF: Dokument-Ansicht (kein Admin-Viewer) —— */
.inv-doc-modal[hidden] {
    display: none !important;
}

.inv-doc-modal {
    position: fixed;
    inset: 0;
    z-index: 10100;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.inv-doc-modal.open {
    display: block;
}

.inv-doc-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: rgba(245, 245, 246, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.inv-doc-scroll {
    position: relative;
    z-index: 1;
    min-height: 100%;
    padding: 72px 1.5rem 96px;
    box-sizing: border-box;
    background-color: #f4f4f5;
    background-image: none;
}

.inv-doc-shell {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
}

.inv-doc-modal.open .inv-doc-shell {
    animation: inv-doc-enter 0.18s ease forwards;
}

@keyframes inv-doc-enter {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.inv-doc-bar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0 0.85rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(180deg, rgba(244, 244, 245, 0.97) 0%, rgba(244, 244, 245, 0.88) 65%, rgba(244, 244, 245, 0) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.inv-doc-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #1e293b;
}

.inv-doc-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

.inv-doc-textbtn {
    padding: 0.45rem 0.65rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.inv-doc-textbtn:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.05);
}

.inv-doc-close {
    margin-left: 0.25rem;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.inv-doc-close:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.06);
}

.inv-doc-paper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    box-shadow:
        0 1px 0 rgba(0, 0, 0, 0.04),
        0 12px 40px rgba(15, 23, 42, 0.08);
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.inv-doc-frame {
    display: block;
    width: 100%;
    min-height: calc(100vh - 176px);
    height: min(1200px, calc(100vh - 168px));
    border: 0;
    background: #fafafa;
}

@media (max-width: 640px) {
    .inv-doc-scroll {
        padding: 52px 0.75rem 64px;
    }

    .inv-doc-paper {
        max-width: none;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
        border-radius: 0;
    }

    .inv-doc-frame {
        min-height: 75vh;
        height: min(100vh, calc(100vh - 140px));
    }

    .inv-doc-textbtn {
        padding: 0.4rem 0.45rem;
        font-size: 0.75rem;
    }

    .inv-doc-bar {
        flex-wrap: wrap;
        padding-bottom: 0.65rem;
    }
}
