/* Shared master-card layout. Every rule is scoped to .master-card. */

.master-card,
.master-card * {
    box-sizing: border-box;
}

.master-card .master-card-dialog {
    width: min(840px, calc(100vw - 1.5rem));
    max-width: min(840px, calc(100vw - 1.5rem));
}

.master-card .master-card-dialog.master-card-dialog-narrow {
    width: min(680px, calc(100vw - 1.5rem));
    max-width: min(680px, calc(100vw - 1.5rem));
}

/* The dialog scrolls as one piece, the same way the client card does. */
.master-card.modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

.master-card .modal-dialog,
.master-card .modal-content,
.master-card .modal-content > form,
.master-card .modal-body {
    height: auto;
    max-height: none;
    overflow: visible;
}

.master-card-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.master-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.master-card-status {
    margin-inline-start: auto;
}

.master-card-heading,
.master-card-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0.75rem 0 0.5rem;
    padding: calc(0.7rem + 1.5px) 1rem;
    border: 0;
    border-radius: 0.475rem;
    background: var(--bs-gray-200);
    color: var(--bs-gray-900);
    font-weight: 400;
    font-size: 1.075rem;
    line-height: 1.5;
    text-align: start;
}

.master-card-toggle {
    cursor: pointer;
    font: inherit;
    font-weight: 400;
    font-size: 1.075rem;
    transition: background-color 0.15s ease;
}

.master-card-heading-note {
    margin-inline-start: 0.65rem;
    font-size: 0.85rem;
    font-weight: 400 !important;
    font-style: normal;
    color: var(--bs-gray-600);
}

.master-card-toggle:hover,
.master-card-toggle:focus-visible {
    background: var(--bs-gray-300);
}

.master-card-panel {
    padding: 0.5rem 2rem 0.25rem;
}

.master-card-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    padding: 0;
}

.master-card-label {
    flex: 0 0 200px;
    max-width: 200px;
    padding-top: 0;
    font-weight: 400;
    font-size: 1.05rem;
    color: var(--bs-gray-800);
}

.master-card-field {
    flex: 1 1 auto;
    min-width: 0;
}

.master-card-details,
.master-card-details .btn {
    font-weight: 400;
}

.master-card .e-checkbox-wrapper .e-label,
.master-card .e-css.e-checkbox-wrapper .e-label {
    font-weight: 400;
    font-size: 1rem;
}

.master-card-row.is-check,
.master-card-note,
.master-card-alert {
    margin-inline-start: calc(200px + 1rem);
}

.master-card-row.is-check {
    margin-bottom: 0.6rem;
}

.master-card-note {
    display: flex;
    align-items: center;
    margin-top: -0.15rem;
    margin-bottom: 0.5rem;
    font-size: 0.925rem;
    font-weight: 400;
    color: var(--bs-primary);
}

.master-card-note.is-danger {
    color: var(--bs-danger);
}

.master-card-meta .master-card-note.is-inline {
    margin: 0;
    margin-inline-start: 0;
    color: var(--bs-danger);
}

.master-card-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.master-card-inline-grow {
    flex: 1 1 12rem;
    min-width: 10rem;
}

.master-card-rule {
    margin: 0.15rem 0 0.8rem;
    border: 0;
    border-top: 1px solid var(--bs-gray-200);
}

.master-card-chevron {
    display: inline-flex;
    margin-inline-start: auto;
    transition: transform 0.15s ease;
}

.master-card-chevron.is-collapsed {
    transform: rotate(-90deg);
}

[dir="rtl"] .master-card .required:after {
    padding-left: 0;
    padding-right: 0.35rem;
}

[dir="rtl"] .master-card-chevron.is-collapsed {
    transform: rotate(90deg);
}

[dir="rtl"] .master-card .master-card-status,
[dir="rtl"] .master-card .master-card-chevron {
    margin-left: 0 !important;
    margin-right: auto !important;
}

@media (max-width: 576px) {
    .master-card .master-card-dialog {
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
    }

    .master-card-panel {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .master-card-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
    }

    .master-card-label {
        flex-basis: auto;
        max-width: none;
        padding-top: 0;
    }

    .master-card-row.is-check,
    .master-card-note,
    .master-card-alert {
        margin-inline-start: 0;
    }

    .master-card-inline {
        flex-wrap: wrap;
    }
}

/* Parent dropdown popup is rendered outside .master-card. Scoped to this dropdown only. */
.coa-parent-tree .coa-tree-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.coa-parent-tree .coa-tree-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.coa-parent-tree .coa-tree-kind {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex: 0 0 1.1rem;
    width: 0.562rem !important;
    min-width: 1.1rem !important;
    max-width: 1.1rem !important;
    height: 1.1rem;
    margin-inline-start: auto;
    padding: 0 !important;
    border-radius: 0.2rem;
    font-size: 0.85rem !important;
    font-weight: 700;
    line-height: 1 !important;
    text-align: center;
}

.e-popup.coa-parent-tree .e-list-item .coa-tree-kind.badge-light-primary {
    background-color: #f3e8ff !important;
    color: #7c3aed !important;
}

.e-popup.coa-parent-tree .e-list-item .coa-tree-kind.badge-light-success {
    background-color: #dcfce7 !important;
    color: #15803d !important;
}

.e-popup.coa-parent-tree .e-list-item .coa-tree-kind.badge-light-warning {
    background-color: #ffedd5 !important;
    color: #c2410c !important;
}

.e-popup.coa-parent-tree .coa-tree-folder {
    margin-inline-end: 0.45rem;
    font-size: 1.05rem;
    line-height: 1;
    color: #9ca3af;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-asset),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-asset) {
    background-color: #f3e8ff !important;
    color: #7c3aed !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-liability),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-liability) {
    background-color: #fce7f3 !important;
    color: #db2777 !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-equity),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-equity) {
    background-color: #f3f4f6 !important;
    color: #4b5563 !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-revenue),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-revenue) {
    background-color: #dcfce7 !important;
    color: #15803d !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-expense),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-expense) {
    background-color: #ffedd5 !important;
    color: #c2410c !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-general),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-general) {
    background-color: #f3e8ff !important;
    color: #7c3aed !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-sales),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-sales) {
    background-color: #dcfce7 !important;
    color: #15803d !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-operation),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-operation) {
    background-color: #ffedd5 !important;
    color: #c2410c !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root) .coa-tree-folder {
    color: inherit;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-goods),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-goods) {
    background-color: #f3e8ff !important;
    color: #7c3aed !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-grouped),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-grouped) {
    background-color: #f3f4f6 !important;
    color: #4b5563 !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-half),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-half) {
    background-color: #ffedd5 !important;
    color: #c2410c !important;
}

.e-popup.coa-parent-tree .e-list-item:has(.coa-tree-root-product),
.e-popup.coa-parent-tree .e-list-item.e-hover:has(.coa-tree-root-product) {
    background-color: #dcfce7 !important;
    color: #15803d !important;
}
