/* ==========================================================================
   CraftX ERP — Finance surface utilities
   Layout primitives specific to InvoiceProcessing + Expenditures pages.
   Token-only: all values reference vars defined in app.css / cx-widgets.css.

   Namespace: .cx-finance-*
   This file augments the global widget kit (.card, .chip, .btn, .data-table,
   .stat-card, .list-row from cx-widgets.css) with patterns the Finance
   surface (Eingangsrechnungen / Kassenbuch / Auswertungen) reuses.
   ========================================================================== */

/* ── Reject voucher option button ─────────────────────────────────────────
   Used in CashBookPage's voucher-reject dialog to offer two large, clearly
   differentiated choices (umklassifizieren vs. endgültig ablehnen). The
   warm-tone palette here matches the rest of the carpenter surfaces and
   reads as a distinct visual unit from the surrounding form. */

.cx-finance-reject-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    width: 100%;
    text-align: left;
    background: var(--cx-card-bg);
    border: 1px solid var(--cx-hairline);
    border-radius: var(--cx-radius-control);
    color: var(--cx-text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.cx-finance-reject-option:hover:not(:disabled) {
    border-color: var(--cx-primary);
    background: var(--cx-primary-soft);
}

.cx-finance-reject-option:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cx-finance-reject-option.is-danger:hover:not(:disabled) {
    border-color: var(--cx-danger);
    background: color-mix(in srgb, var(--cx-danger) 8%, white);
}

.cx-finance-reject-option__icon {
    font-size: 1.25rem;
    color: var(--cx-primary);
    flex-shrink: 0;
}

.cx-finance-reject-option.is-danger .cx-finance-reject-option__icon {
    color: var(--cx-danger);
}

.cx-finance-reject-option__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cx-finance-reject-option__title {
    font-weight: var(--fw-semibold);
    font-size: 13px;
    color: var(--cx-text-primary);
    line-height: 1.3;
}

.cx-finance-reject-option__sub {
    font-size: 12px;
    color: var(--cx-text-muted);
    line-height: 1.35;
}

/* ── Prüf-Dialog: Hülle ─────────────────────────────────────────────────────
   The review of a document as a page in the frame of the app (Welle 4): it fills the content area under the app bar,
   with no stacking context of its own, so the reject dialog, the position dialog and every dropdown of the Syncfusion band
   (cx-syncfusion-overrides.css) open above it, and the side panels with their own 5040/5050 above the frame. No transform,
   filter or animation on .cap-review or below: the panels are position: fixed and would land in that element instead of
   the window. */
.cap-review {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: var(--paper);
    outline: none;
}

.cap-review-body {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.cap-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px 20px 24px;
}

.cap-foot {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 10px;
    padding: 10px 20px;
    border-top: 1px solid var(--cx-hairline);
    background: var(--paper);
}

/* Its own line when it has to be, so neither the sentence nor the buttons give way. */

.cap-modal-scrim {
    position: fixed;
    inset: 0;
    z-index: 5040;
    background: rgba(28, 25, 21, 0.5);
}

.cap-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 5050;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(480px, calc(100vw - 32px));
    padding: 20px;
    box-sizing: border-box;
    border-radius: var(--cx-radius-surface);
    background: var(--cx-card-bg);
    box-shadow: 0 28px 56px rgba(28, 25, 21, 0.18);
    outline: none;
    translate: -50% -50%;
}

.cap-modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* Between the document and the form one calm divider: a hairline in the border colour and the grip, nothing else. The
   theme draws a tinted bar with a border on each side and a paper-coloured strip under the grip (Owner-Runde 2, 08.11.).
   The bar keeps its width, so it stays as easy to take hold of, and carries the sand of both panes under the line: a
   transparent bar let the lighter page through as a pale strip beside the line. */
.cap-review .invoice-validation-splitter > .e-split-bar.e-split-bar-horizontal,
.cap-review .invoice-validation-splitter > .e-split-bar.e-split-bar-horizontal:hover,
.cap-review .invoice-validation-splitter > .e-split-bar.e-split-bar-horizontal.e-split-bar-hover,
.cap-review .invoice-validation-splitter > .e-split-bar.e-split-bar-horizontal.e-split-bar-active {
    border: 0;
    background: linear-gradient(var(--cx-hairline-strong), var(--cx-hairline-strong)) center / 1px 100% no-repeat, var(--cx-card-bg);
}

.cap-review .invoice-validation-splitter > .e-split-bar .e-resize-handler {
    border: 0;
    background: transparent;
}

/* The document on top and the form under it, each scrolling on its own. The splitter writes its sizes into the panes, so
   only !important reaches them. The limit is 800 px: a document pane of 300 and a panel of 480 never fit below it. */
@media (max-width: 800px) {
    .cap-review .invoice-validation-splitter.e-splitter-horizontal {
        flex-direction: column;
        touch-action: auto;
    }

    .cap-review .invoice-validation-splitter > .e-split-bar {
        display: none;
    }

    .cap-review .invoice-validation-splitter > .e-pane {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .cap-review .invoice-validation-splitter > .e-pane:first-of-type {
        flex: 0 0 36% !important;
        min-height: 0;
    }

    .cap-review .invoice-validation-splitter > .e-pane ~ .e-pane {
        flex: 1 1 0 !important;
        min-height: 0;
    }

    .cap-review .left-panel-container {
        overflow-y: auto;
    }

    .cap-review .pdf-viewer-section {
        min-height: 200px;
    }

    .cap-form {
        padding: 12px 16px 20px;
    }

    .cap-foot {
        padding: 8px 16px;
    }

}

/* ── Prüf-Dialog: Belegdaten, Kategorisierung, Zahlung ─────────────────────
   Three calm sections without nested frames. The fields are the form primitives from cx-widgets.css, .form-row turns
   into one column at phone width. */
.cap-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cap-section .form-field {
    margin-bottom: 0;
}

.cap-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--cx-text-primary);
}

.cap-supplier {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    min-height: 44px;
    padding: 6px 12px;
    box-sizing: border-box;
    border: 1px solid var(--cx-hairline);
    border-radius: var(--cx-radius-surface);
}

.cap-badge {
    padding: 2px 8px;
    border-radius: var(--cx-radius-control);
    background: var(--warning-50);
    color: var(--cx-text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.cap-badge.good {
    background: var(--success-50);
}

.cap-link {
    padding: 0;
    border: none;
    background: none;
    color: var(--cx-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.cap-chip {
    align-self: flex-start;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--cx-primary);
    border-radius: var(--cx-radius-control);
    background: var(--cx-primary-soft);
    color: var(--cx-text-primary);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.cap-line {
    margin: 0;
    font-size: 13px;
    color: var(--cx-text-secondary);
}

.cap-hint {
    margin: 0;
    font-size: 12px;
    color: var(--cx-text-secondary);
}

.cap-warning {
    margin: 0;
    padding: 8px 10px;
    border-radius: var(--cx-radius-surface);
    background: var(--warning-50);
    font-size: 12px;
    line-height: 1.5;
    color: var(--cx-text-primary);
}

.cap-note {
    align-self: start;
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--cx-radius-surface);
    background: var(--paper-2);
    font-size: 13px;
    line-height: 1.5;
    color: var(--cx-text-primary);
}

.cap-date {
    max-width: 240px;
}

@media (max-width: 720px) {
    .cap-date {
        max-width: none;
    }

}
