/* Entity composer — global styles (Radzen dialogs; do not rely on Blazor CSS isolation). */

.rz-dialog.rz-wizard-dialog-80 .rz-dialog-content > .entity-composer-host,
.rz-dialog.rz-wizard-dialog-80 .rz-dialog-content .entity-composer-host {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.entity-composer-host {
    --ec-ink: #1a2332;
    --ec-muted: #5c6b7a;
    --ec-line: #d9e2ec;
    --ec-surface: #ffffff;
    --ec-canvas: #f4f7fb;
    --ec-teal: #0d9488;
    --ec-teal-deep: #0f766e;
    --ec-teal-soft: #ccfbf1;
    --ec-blue: #2563eb;
    --ec-blue-soft: #dbeafe;
    --ec-amber: #d97706;
    --ec-amber-soft: #fef3c7;
    --ec-rose: #e11d48;
    --ec-rose-soft: #ffe4e6;
    --ec-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    --ec-radius: 14px;

    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background:
        radial-gradient(1200px 280px at 0% 0%, rgba(13, 148, 136, 0.12), transparent 55%),
        radial-gradient(900px 240px at 100% 0%, rgba(37, 99, 235, 0.10), transparent 50%),
        var(--ec-canvas);
    color: var(--ec-ink);
    box-sizing: border-box;
}

.entity-composer-busy-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 1.25rem;
    background: rgba(244, 247, 251, 0.72);
    backdrop-filter: blur(2px);
    pointer-events: all;
}

.entity-composer-busy-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ec-ink);
    text-align: center;
}

.entity-composer-host.is-action-busy {
    pointer-events: none;
}

.entity-composer-host.is-action-busy .entity-composer-busy-overlay {
    pointer-events: all;
}

.entity-composer-loading,
.entity-composer-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    min-height: 14rem;
    padding: 2rem;
    text-align: center;
    color: var(--ec-muted);
}

.entity-composer-host--loading {
    min-height: 100%;
}

.entity-composer-loading-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0.85rem;
    padding: 0.9rem 1.25rem 1.25rem;
}

.entity-composer-skeleton-rail {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.45rem;
    overflow: hidden;
    padding: 0.35rem;
}

.entity-composer-skeleton-chip {
    display: inline-block;
    width: 5.5rem;
    height: 2rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
    background-size: 200% 100%;
    animation: entity-composer-shimmer 1.2s ease-in-out infinite;
}

.entity-composer-skeleton-panel {
    flex: 1;
    min-height: 12rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    border-radius: var(--ec-radius);
    background: var(--ec-surface);
    border: 1px solid var(--ec-line);
    color: var(--ec-muted);
    font-weight: 600;
}

@keyframes entity-composer-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.entity-composer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem 0.85rem;
    border-bottom: 1px solid rgba(217, 226, 236, 0.9);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
    backdrop-filter: blur(6px);
}

.entity-composer-header-main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.entity-composer-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ec-teal-deep);
}

.entity-composer-title {
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1.25;
    color: var(--ec-ink);
}

.entity-composer-subtitle {
    font-size: 0.86rem;
    color: var(--ec-muted);
}

.entity-composer-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.entity-composer-field-help-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.2rem 0.55rem 0.2rem 0.35rem;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 600;
    user-select: none;
    white-space: nowrap;
}

.entity-composer-field-help-toggle-label {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    cursor: pointer;
}

.entity-composer-field-help-toggle-label:disabled {
    opacity: 0.65;
    cursor: default;
}

.entity-composer-template-wrap {
    margin: 0.75rem 1.25rem 0;
    padding: 0.85rem 1rem;
    border-radius: var(--ec-radius);
    background: var(--ec-surface);
    border: 1px solid var(--ec-line);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.entity-composer-template-summary {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.15rem 0;
    border: none;
    background: transparent;
    text-align: start;
    cursor: pointer;
    user-select: none;
    color: inherit;
}

.entity-composer-template-summary::after {
    content: "▾";
    float: inline-end;
    opacity: 0.7;
    font-size: 0.85rem;
}

.entity-composer-template-wrap.is-expanded > .entity-composer-template-summary {
    margin-bottom: 0.65rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px dashed #e2e8f0;
}

.entity-composer-template-wrap.is-expanded > .entity-composer-template-summary::after {
    content: "▴";
}

.entity-composer-template-summary-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ec-ink);
}

.entity-composer-template-summary-hint {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: var(--ec-muted);
    font-weight: 500;
}

.entity-composer-template-body {
    display: block;
}

.entity-composer-template-wrap:not(.is-expanded) > .entity-composer-template-body {
    display: none;
}

.entity-composer-template-wrap .entry-template-bar {
    margin: 0;
}

.entity-composer-section-nav {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    margin-top: 1.1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed #e2e8f0;
}

.entity-composer-section-nav .rz-button,
.np-composer-preview-nav .rz-button {
    flex: 1 1 0;
    min-width: 0;
}

.np-composer-preview-nav {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    margin-top: 0.7rem;
}

@media (min-width: 641px) {
    .np-composer-preview-nav {
        display: flex;
    }
}

.entity-composer-alert {
    margin: 0.75rem 1.25rem 0;
}

.entity-composer-alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.entity-composer-alert-list {
    margin: 0;
    padding-inline-start: 1.1rem;
}

.entity-composer-alert-list li + li {
    margin-top: 0.2rem;
}

.entity-composer-alert-issue {
    display: inline;
}

.entity-composer-alert-jump {
    margin-inline-start: 0.4rem;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.entity-composer-alert-jump:disabled {
    cursor: default;
    opacity: 0.6;
}

.entity-composer-alert-more {
    margin-top: 0.25rem;
    font-style: italic;
}

.entity-composer-main {
    display: grid;
    grid-template-columns: 13.5rem minmax(0, 1fr);
    gap: 1rem;
    flex: 1;
    min-height: 0;
    padding: 0.9rem 1.25rem 0.35rem;
}

.entity-composer-rail {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    overflow: auto;
    padding: 0.35rem;
    border-radius: var(--ec-radius);
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(217, 226, 236, 0.95);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.entity-composer-rail-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    text-align: start;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 12px;
    padding: 0.7rem 0.75rem;
    cursor: pointer;
    color: var(--ec-ink);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.entity-composer-rail-item:hover:not(:disabled):not(.is-active) {
    background: #fff;
    border-color: #c7d5e3;
    transform: translateY(-1px);
}

.entity-composer-rail-item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.entity-composer-rail-item.is-active {
    background: linear-gradient(135deg, #0d9488 0%, #2563eb 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 18px rgba(13, 148, 136, 0.28);
}

.entity-composer-rail-item.is-active:hover:not(:disabled) {
    background: #e8f5f3;
    border-color: #99d5cf;
    color: #0f172a;
    box-shadow: none;
}

.entity-composer-rail-item.is-active:hover:not(:disabled) .entity-composer-rail-index {
    background: #ccfbf1;
    color: #0f766e;
}

.entity-composer-rail-item.has-error:not(.is-active) {
    border-color: #fda4af;
    background: var(--ec-rose-soft);
}

.entity-composer-rail-item.has-error.is-active {
    box-shadow: 0 8px 18px rgba(225, 29, 72, 0.25);
    background: linear-gradient(135deg, #e11d48 0%, #f97316 100%);
}

.entity-composer-rail-index {
    flex: 0 0 1.75rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--ec-blue-soft);
    color: var(--ec-blue);
}

.entity-composer-rail-item.is-active .entity-composer-rail-index {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.entity-composer-rail-copy {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}

.entity-composer-rail-label {
    font-weight: 650;
    font-size: 0.92rem;
    line-height: 1.2;
}

.entity-composer-rail-hint {
    font-size: 0.72rem;
    opacity: 0.78;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-composer-center {
    overflow: auto;
    min-width: 0;
    padding: 0.15rem 0.15rem 0.65rem;
}

.entity-composer-panel {
    background: var(--ec-surface);
    border: 1px solid var(--ec-line);
    border-radius: calc(var(--ec-radius) + 2px);
    box-shadow: var(--ec-shadow);
    padding: 1.1rem 1.2rem 1.25rem;
    min-height: 100%;
    box-sizing: border-box;
}

.entity-composer-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed #e2e8f0;
}

.entity-composer-panel-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.entity-composer-panel-badge {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ec-teal-deep);
    background: var(--ec-teal-soft);
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
}

.entity-composer-footer {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem 1.25rem 1rem;
    margin-top: auto;
    border-top: 1px solid rgba(217, 226, 236, 0.95);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), #fff);
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.entity-composer-footer-desktop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
}

.entity-composer-footer-primary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.entity-composer-footer-mobile,
.entity-composer-footer-sheet {
    display: none;
}

.entity-composer-footer-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.65rem;
    padding: 0 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--ec-line);
    background: #fff;
    color: var(--ec-ink);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    flex: 0 0 auto;
}

.entity-composer-footer-more-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.entity-composer-footer-sheet {
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
    padding-top: 0.15rem;
}

.entity-composer-footer-sheet-btn {
    width: 100% !important;
}

.entity-composer-footer-mobile-save {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.entity-composer-footer-mobile-cancel {
    flex: 0 0 auto !important;
}

.entity-composer-fields {
    display: grid;
    gap: 0.95rem 1.35rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entity-composer-field {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    min-width: 0;
}

.entity-composer-field-editor {
    flex: 1;
    min-width: 0;
}

.entity-composer-udf-class-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.entity-composer-udf-class-editor {
    flex: 1;
    min-width: 0;
}

.entity-composer-udf-class-editor .form-group,
.entity-composer-udf-class-editor .dynamic-field-editor {
    margin-bottom: 0;
}

.entity-composer-udf-class-add {
    flex-shrink: 0;
    align-self: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid #90caf9;
    border-radius: 8px;
    background: #e3f2fd;
    color: #1565c0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.entity-composer-udf-class-add:hover:not(:disabled) {
    background: #bbdefb;
}

.entity-composer-udf-class-add:disabled {
    opacity: 0.45;
    cursor: default;
}

.entity-composer-field-hint {
    margin-top: 1.75rem;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0d9488, #2563eb);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    line-height: 1;
    font-size: 0.72rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.entity-composer-field-hint:hover:not(:disabled) {
    filter: brightness(1.06);
}

.entity-composer-field-hint:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ec-payee-type-label-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}

.ec-payee-type-label-row .entity-composer-field-hint {
    margin-top: 0;
}

/* Note payable cheque preview */
.np-composer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 17.5rem;
    gap: 1.1rem;
    align-items: start;
}

.np-composer-section-hint {
    color: var(--ec-muted, #5c6b7a);
    font-size: 0.875rem;
    margin: 0 0 0.9rem;
    line-height: 1.45;
}

.entity-composer-udf-add {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ec-border, #e2e8f0);
}

.entity-composer-udf-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.entity-composer-udf-add-row .form-select {
    flex: 1 1 12rem;
    min-width: 0;
}

.np-composer-preview {
    position: sticky;
    top: 0.25rem;
}

.np-composer-preview-summary {
    display: none;
}

.np-composer-preview-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    padding: 1.15rem 1.1rem 1.2rem;
    color: #ecfeff;
    background:
        linear-gradient(145deg, #0f766e 0%, #115e59 42%, #1e3a5f 100%);
    box-shadow: 0 14px 30px rgba(15, 118, 110, 0.28);
}

.np-composer-preview-card::before {
    content: "";
    position: absolute;
    inset: auto -20% -35% auto;
    width: 12rem;
    height: 12rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 70%);
    pointer-events: none;
}

.np-composer-preview-kicker {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 0.55rem;
}

.np-composer-preview-payee {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
}

.np-composer-preview-amount {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0.45rem 0 1rem;
}

.np-composer-preview-meta {
    margin: 0;
    display: grid;
    gap: 0.55rem;
}

.np-composer-preview-meta > div {
    display: grid;
    gap: 0.1rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.np-composer-preview-meta dt {
    font-size: 0.7rem;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.np-composer-preview-meta dd {
    margin: 0;
    font-weight: 600;
    font-size: 0.92rem;
}

@media (max-width: 1100px) {
    .np-composer-layout {
        grid-template-columns: 1fr;
    }

    .np-composer-preview {
        position: static;
        order: 2;
    }

    .np-composer-fields {
        order: 1;
    }
}

@media (max-width: 900px) {
    .entity-composer-main {
        grid-template-columns: 1fr;
        padding-inline: 0.85rem;
    }

    .entity-composer-rail {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.4rem;
        padding-bottom: 0.15rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .entity-composer-rail-item {
        flex: 0 0 auto;
        min-width: 0;
        padding: 0.45rem 0.7rem;
        gap: 0.4rem;
    }

    .entity-composer-rail-hint {
        display: none;
    }

    .entity-composer-rail-copy {
        gap: 0;
    }

    .entity-composer-rail-label {
        white-space: nowrap;
        font-size: 0.82rem;
    }

    .entity-composer-fields {
        grid-template-columns: 1fr;
    }

    .entity-composer-header,
    .entity-composer-footer,
    .entity-composer-template-wrap {
        padding-inline: 0.85rem;
        margin-inline: 0.85rem;
    }

    .entity-composer-template-wrap {
        margin-inline: 0.85rem;
    }
}

/* Phone: edge-to-edge dialog, compact sticky footer, deferred preview */
@media (max-width: 640px) {
    .rz-dialog-wrapper.rz-entity-composer-dialog-wrap {
        align-items: stretch !important;
        justify-content: stretch !important;
        padding: 0 !important;
    }

    .rz-dialog.rz-entity-composer-dialog,
    .rz-dialog.rz-wizard-dialog-80.rz-entity-composer-dialog {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }

    .rz-dialog.rz-entity-composer-dialog .rz-dialog-content {
        padding: 0 !important;
        height: 100% !important;
        max-height: 100% !important;
    }

    .entity-composer-host {
        height: 100dvh !important;
        max-height: 100dvh !important;
    }

    .entity-composer-header {
        padding: 0.65rem 0.75rem;
        margin-inline: 0;
        gap: 0.5rem;
        align-items: center;
    }

    .entity-composer-title {
        font-size: 1.02rem;
    }

    .entity-composer-header-actions {
        gap: 0.3rem;
    }

    .entity-composer-field-help-toggle-label {
        display: none;
    }

    .entity-composer-template-wrap,
    .entity-composer-alert {
        margin: 0.5rem 0.75rem 0;
        padding: 0.55rem 0.65rem;
    }

    .entity-composer-section-nav {
        display: flex;
    }

    .entity-composer-main {
        padding: 0.55rem 0.75rem 0.25rem;
        gap: 0.55rem;
    }

    .entity-composer-rail-item {
        min-width: 0;
        padding: 0.35rem 0.55rem;
        border-radius: 999px;
    }

    .entity-composer-rail-index {
        width: 1.35rem;
        height: 1.35rem;
        font-size: 0.72rem;
    }

    .entity-composer-panel {
        padding: 0.75rem 0.75rem 0.85rem;
        border-radius: 12px;
    }

    .entity-composer-panel-head {
        margin-bottom: 0.7rem;
        padding-bottom: 0.55rem;
    }

    .entity-composer-footer {
        margin-inline: 0;
        padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    }

    .entity-composer-footer-desktop {
        display: none;
    }

    .entity-composer-footer-mobile {
        display: flex;
        align-items: stretch;
        gap: 0.45rem;
        width: 100%;
    }

    .entity-composer-footer-sheet {
        display: flex;
    }

    .np-composer-preview-summary {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "kicker chevron"
            "payee amount";
        gap: 0.15rem 0.65rem;
        width: 100%;
        margin: 0 0 0.55rem;
        padding: 0.7rem 0.85rem;
        border: none;
        border-radius: 12px;
        text-align: start;
        cursor: pointer;
        color: #ecfeff;
        background: linear-gradient(145deg, #0f766e 0%, #1e3a5f 100%);
        box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
    }

    .np-composer-preview-summary-kicker {
        grid-area: kicker;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        opacity: 0.85;
    }

    .np-composer-preview-summary-payee {
        grid-area: payee;
        font-weight: 700;
        font-size: 0.92rem;
        line-height: 1.25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .np-composer-preview-summary-amount {
        grid-area: amount;
        font-weight: 800;
        font-size: 1rem;
        justify-self: end;
        align-self: end;
    }

    .np-composer-preview-summary-chevron {
        grid-area: chevron;
        justify-self: end;
        opacity: 0.85;
        font-size: 0.85rem;
    }

    .np-composer-preview-card {
        display: none;
        margin-top: 0;
    }

    .np-composer-preview-card.is-expanded {
        display: block;
    }
}

/* RTL */
[dir="rtl"] .entity-composer-rail-item,
[dir="rtl"] .entity-composer-field {
    text-align: start;
}

[dir="rtl"] .entity-composer-footer-primary {
    justify-content: flex-start;
}

[dir="rtl"] .entity-composer-footer-mobile {
    flex-direction: row-reverse;
}

/* SVI-style simple lines (reusable for any composer collection) */
.ec-simple-lines {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ec-simple-lines-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ec-simple-lines-summary {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    border-radius: 12px;
    background: #eef6fc;
    color: #0d47a1;
    font-size: 0.88rem;
}

.ec-simple-lines-total {
    font-weight: 700;
    color: #1565c0;
}

.ec-simple-lines-add {
    border: 1px solid #bbdefb;
    background: #fff;
    color: #1565c0;
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ec-simple-lines-add:hover:not(:disabled) {
    background: #e3f2fd;
}

.ec-simple-lines-add:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ec-simple-lines-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #78909c;
    border: 1px dashed #cfd8dc;
    border-radius: 14px;
    background: #fafbfc;
}

.ec-simple-lines-empty-inline {
    border: none;
    background: transparent;
    padding: 1.25rem 0.75rem;
}

.ec-simple-lines-empty-row td {
    border-bottom: none !important;
}

.ec-simple-lines-required {
    color: #dc2626;
    font-weight: 700;
    margin-inline-start: 0.15rem;
}

.ec-simple-lines-empty i {
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
    display: block;
}

.ec-simple-lines-table-wrap {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: auto;
    max-height: min(52vh, 28rem);
    background: #fff;
}

.ec-simple-lines-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 36rem;
}

.ec-simple-lines-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: start;
    padding: 0.65rem 0.7rem;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.ec-simple-lines-table td {
    padding: 0.45rem 0.55rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.ec-simple-lines-table tr:last-child td {
    border-bottom: none;
}

.ec-simple-lines-table .dynamic-field-editor {
    margin: 0;
}

.ec-simple-lines-table .dynamic-field-editor-value-only,
.ec-simple-lines-table .form-group {
    margin-bottom: 0;
}

.ec-simple-lines-th-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ec-simple-lines-th-inner .entity-composer-field-hint {
    margin-top: 0;
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.62rem;
    box-shadow: none;
}

.ec-simple-lines-col-amount {
    width: 8.5rem;
    text-align: end !important;
}

.ec-simple-lines-col-ref {
    min-width: 13rem;
}

.ec-simple-lines-col-action {
    width: 3rem;
    text-align: end !important;
}

@media (max-width: 640px) {
    .ec-simple-lines-col-phone-hide {
        display: none !important;
    }
}

.ec-simple-lines-delete {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #90a4ae;
    cursor: pointer;
}

.ec-simple-lines-delete:hover:not(:disabled) {
    background: #eceff1;
    color: #c62828;
}

.ec-simple-lines-delete:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Payee type button group */
.ec-payee-type {
    margin-bottom: 1.1rem;
}

.ec-payee-type-label {
    font-size: 0.82rem;
    font-weight: 650;
    color: var(--ec-ink, #1a2332);
    margin-bottom: 0.45rem;
}

.ec-payee-type-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.ec-payee-type-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #d0dae6;
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 0.42rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.ec-payee-type-btn i {
    font-size: 0.85rem;
    opacity: 0.85;
}

.ec-payee-type-btn:hover:not(:disabled):not(.is-selected) {
    border-color: #94a3b8;
    background: #f8fafc;
    color: #0f172a;
}

.ec-payee-type-btn.is-selected {
    border-color: transparent;
    background: linear-gradient(135deg, #0d9488 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 6px 14px rgba(13, 148, 136, 0.28);
}

.ec-payee-type-btn.is-selected:hover:not(:disabled) {
    background: #e8f5f3;
    border-color: #99d5cf;
    color: #0f172a;
    box-shadow: none;
}

.ec-payee-type-btn.is-selected:hover:not(:disabled) i {
    color: #0f172a;
    opacity: 1;
}

.ec-payee-type-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ec-payee-type-desc {
    margin: 0.55rem 0 0;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    color: #115e59;
    font-size: 0.84rem;
    line-height: 1.4;
}

.np-ap-field .entity-composer-field-editor {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Secondary field info (balance, etc.): right-aligned under the lookup trailing controls. */
.np-field-meta,
.np-ap-balance {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.3;
    text-align: end;
    align-self: stretch;
    /* Sit under the clear/dropdown cluster inside the input (before Find / ?). */
    padding-inline-end: 2.75rem;
}

.np-ap-balance strong,
.np-field-meta strong {
    color: #334155;
    font-weight: 650;
}

.np-amount-from-lines {
    margin-bottom: 0.85rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.np-doc-link {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.np-doc-link-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.np-doc-link-title {
    font-size: 0.88rem;
    font-weight: 650;
    color: #0f172a;
}

.np-doc-link-hint {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.35;
    max-width: 28rem;
}

.np-doc-link-open {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #94a3b8;
    background: #fff;
    color: #0f172a;
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.np-doc-link-open:hover:not(:disabled) {
    border-color: #0d9488;
    color: #0f766e;
}

.np-doc-link-open:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.np-doc-link-selected {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #99f6e4;
}

.np-doc-link-selected-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.np-doc-link-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #0f766e;
    background: #ccfbf1;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
}

.np-doc-link-clear {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.np-doc-link-clear:hover:not(:disabled) {
    color: #b91c1c;
}

.np-doc-link-none {
    margin-top: 0.55rem;
    font-size: 0.78rem;
    color: #94a3b8;
}

.np-doc-picker {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    height: 100%;
    padding: 0.25rem 0.15rem 0.5rem;
}

.np-doc-picker-toggle {
    display: flex;
    gap: 0.35rem;
    padding: 0.2rem;
    border-radius: 999px;
    background: #e2e8f0;
}

.np-doc-picker-tab {
    flex: 1;
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 650;
    color: #475569;
    cursor: pointer;
}

.np-doc-picker-tab.is-active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.np-doc-picker-filter {
    margin-top: 0.15rem;
}

.np-doc-picker-list {
    flex: 1;
    min-height: 12rem;
    max-height: min(48vh, 22rem);
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-right: 0.15rem;
}

.np-doc-picker-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #64748b;
    font-size: 0.86rem;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
}

.np-doc-card {
    text-align: start;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.np-doc-card:hover:not(:disabled) {
    border-color: #94a3b8;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.np-doc-card.is-selected {
    border-color: #0d9488;
    background: #f0fdfa;
    box-shadow: 0 0 0 1px #0d9488;
}

.np-doc-card-top {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
}

.np-doc-card-date {
    font-size: 0.78rem;
    color: #64748b;
}

.np-doc-card-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    margin-top: 0.45rem;
    font-size: 0.78rem;
    color: #475569;
}

.np-doc-card-schedule {
    margin-top: 0.35rem;
    font-size: 0.74rem;
    font-weight: 650;
    color: #0f766e;
}

.np-doc-card-items {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.35;
}

.np-doc-picker-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.35rem;
    border-top: 1px solid #e2e8f0;
}

/* Composer review: print PDF or HTML data summary */
.ec-review {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.ec-review-intro {
    margin: 0;
    font-size: 0.88rem;
    color: #475569;
    line-height: 1.45;
}

.ec-review-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.ec-review-toolbar-label {
    font-size: 0.82rem;
    font-weight: 650;
    color: #0f172a;
}

.ec-review-lang {
    display: inline-flex;
    border-radius: 999px;
    background: #e2e8f0;
    padding: 0.15rem;
}

.ec-review-lang-btn,
.ec-review-variant-btn {
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 650;
    color: #475569;
    cursor: pointer;
}

.ec-review-lang-btn.is-active,
.ec-review-variant-btn.is-active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.ec-review-variants {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.ec-review-refresh {
    margin-inline-start: auto;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 999px;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    color: #475569;
}

.ec-review-preview-frame-wrap {
    position: relative;
    min-height: 22rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    overflow: hidden;
}

.ec-review-pdf {
    width: 100%;
    height: min(62vh, 36rem);
    border: 0;
    background: #fff;
}

.ec-review-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 14rem;
    padding: 2rem;
    color: #64748b;
    font-size: 0.88rem;
}

.ec-review-preview-frame-wrap > .ec-review-spinner {
    position: absolute;
    inset: 0;
    min-height: 0;
    background: rgba(248, 250, 252, 0.94);
    z-index: 2;
}

.ec-review-spinner-block {
    min-height: 18rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.ec-review-print-locked {
    margin: 0 0 0.55rem;
    padding: 0.45rem 0.7rem;
    font-size: 0.8125rem;
    color: #475569;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.ec-review-watermark {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ec-review-watermark > span {
    transform: rotate(-28deg);
    font-size: clamp(1.25rem, 3.5vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    color: rgba(198, 40, 40, 0.14);
    white-space: nowrap;
    user-select: none;
    text-transform: uppercase;
}

.ec-review-error {
    padding: 1.25rem;
    color: #b91c1c;
    font-size: 0.88rem;
}

.ec-review-error-fallback {
    color: #64748b;
    margin-top: 0.35rem;
}

.ec-review-data-details {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
    background: #fff;
}

.ec-review-data-details > summary {
    cursor: pointer;
    font-weight: 650;
    font-size: 0.86rem;
    color: #0f172a;
}

.ec-review-html {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.ec-review-html-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
}

.ec-review-section h5 {
    margin: 0 0 0.45rem;
    font-size: 0.84rem;
    font-weight: 650;
    color: #334155;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.ec-review-count {
    font-weight: 500;
    color: #64748b;
    font-size: 0.78rem;
}

.ec-review-dl {
    margin: 0;
    display: grid;
    gap: 0.35rem;
}

.ec-review-row {
    display: grid;
    grid-template-columns: minmax(7rem, 32%) 1fr;
    gap: 0.5rem 0.75rem;
    font-size: 0.84rem;
}

.ec-review-row dt {
    margin: 0;
    color: #64748b;
    font-weight: 500;
}

.ec-review-row dd {
    margin: 0;
    color: #0f172a;
    font-weight: 600;
    word-break: break-word;
}

.ec-review-lines-table-wrap {
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.ec-review-lines-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.ec-review-lines-table th,
.ec-review-lines-table td {
    padding: 0.4rem 0.55rem;
    border-bottom: 1px solid #eef2f7;
    text-align: start;
}

.ec-review-lines-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 650;
}

.ec-review-open-after {
    margin-top: 0.35rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e2e8f0;
}

.ec-review-open-after-label {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    cursor: pointer;
    font-size: 0.84rem;
}

.ec-review-open-after-title {
    display: block;
    font-weight: 650;
    color: #0f172a;
}

.ec-review-open-after-hint {
    display: block;
    color: #64748b;
    font-size: 0.78rem;
    margin-top: 0.15rem;
}

/* Hide empty Radzen title chrome when ShowTitle=false still leaves spacing */
.rz-dialog.rz-entity-composer-dialog > .rz-dialog-titlebar {
    display: none !important;
}

/* Highlight when opened from a detail structural pen */
.entity-composer-field.is-focus-target,
.ec-payee-type.is-focus-target {
    outline: 2px solid var(--ec-teal, #0d9488);
    outline-offset: 4px;
    border-radius: 10px;
    animation: ec-focus-pulse 1.4s ease-out 1;
}

@keyframes ec-focus-pulse {
    0% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.35); }
    70% { box-shadow: 0 0 0 10px rgba(13, 148, 136, 0); }
    100% { box-shadow: none; }
}
