/* Credit Memo listing — desktop AgGrid + mobile cards */

.wiz-credit-memo-listing-total {
    margin: 0 0 12px;
    font-size: 14px;
    color: #4b5563;
}

.wiz-credit-memo-listing-container {
    width: 100%;
}

.wiz-credit-memo__amount-credit {
    color: #7da50e;
    font-weight: 500;
}

/* Action column: center the button; override AgGrid's inline min-width:150px
   and its injected text-align:left (comes after this stylesheet). */
.wiz-credit-memo-listing-container .table-header-cellcredit_memo_listing[data-field="actions"],
.wiz-credit-memo-listing-container .aggrid-filter-cellcredit_memo_listing[data-field="actions"],
.wiz-credit-memo-listing-container .table-cellcredit_memo_listing[data-field="actions"] {
    min-width: 120px !important;
    width: 120px !important;
    max-width: 120px !important;
    text-align: center !important;
    vertical-align: middle !important;
    overflow: visible;
}

.wiz-credit-memo__action-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.wiz-credit-memo__download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    padding: 8px 14px;
    border: none;
    border-radius: 2px;
    background: var(--primary);
    color: var(--primary-text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.2;
}

.wiz-credit-memo__download:hover {
    opacity: 0.9;
}

.wiz-credit-memo__download:disabled,
.wiz-credit-memo__download.is-loading {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile */

.wiz-credit-memo-mobile {
    width: 100%;
}

.wiz-credit-memo-mobile__total {
    margin: 0 0 12px;
    font-size: 14px;
    color: #4b5563;
}

.wiz-credit-memo-mobile__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wiz-credit-memo-mobile__card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

.wiz-credit-memo-mobile__header {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 12px;
}

.wiz-credit-memo-mobile__header-left,
.wiz-credit-memo-mobile__header-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

/* Left takes leftover space; right sizes to content — ellipsis only when needed. */
.wiz-credit-memo-mobile__header-left {
    flex: 1 1 0;
}

.wiz-credit-memo-mobile__header-right {
    flex: 0 1 auto;
    align-items: flex-end;
    text-align: right;
}

/* Every label/value pair on the card shares this structure — inline in the
   header, stacked in the amounts footer. */

.wiz-credit-memo-mobile__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
}

.wiz-credit-memo-mobile__field--inline {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
}

.wiz-credit-memo-mobile__field-label {
    flex-shrink: 0;
    font-size: 12px;
    color: #6b7280;
}

.wiz-credit-memo-mobile__field-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    color: #111;
}

.wiz-credit-memo-mobile__field--created-on .wiz-credit-memo-mobile__field-value {
    font-size: 12px;
    color: grey;
    padding: 4px;
    background: #f5f5f5;
    border-radius: 5px;
}

.wiz-credit-memo-mobile__metrics .wiz-credit-memo-mobile__field-label {
    color: #9ca3af;
}

.wiz-credit-memo-mobile__metrics .wiz-credit-memo-mobile__field-value {
    font-weight: 600;
}

.wiz-credit-memo-mobile__field--balance .wiz-credit-memo-mobile__field-value {
    color: #d74c10;
}

.wiz-credit-memo-mobile__field--payment .wiz-credit-memo-mobile__field-value {
    color: #6b7280;
}

/* Status — colors come from inline style (control override or get_chip_color_*).
   Style tab only handles geometry + border. */

.wiz-credit-memo-mobile__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    color: #111;
}

.wiz-credit-memo-mobile__status-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    background: var(--wiz-cm-status-dot, #333333);
}

.wiz-credit-memo-mobile__status--chip {
    padding: 4px 10px;
    border-radius: 4px;
    border: 0 solid transparent;
    /* color + background-color set inline from resolve_status_colors() */
}

.wiz-credit-memo-mobile__header-right .wiz-credit-memo-mobile__field {
    justify-content: flex-end;
}

.wiz-credit-memo-mobile__metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.wiz-credit-memo-mobile__metrics[data-columns="1"] {
    grid-template-columns: 1fr;
}

.wiz-credit-memo-mobile__metrics[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.wiz-credit-memo-mobile__empty {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 40px 16px;
    text-align: center;
}

.wiz-credit-memo-mobile__empty.is-visible {
    display: flex;
}

.wiz-credit-memo-mobile__empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.wiz-credit-memo-mobile__empty-subtitle {
    font-size: 14px;
    color: #6b7280;
}

.wiz-credit-memo-mobile__pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.wiz-credit-memo-mobile__pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 30px;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 0;
    background-color: #ffffff;
    color: #2d2d2d;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wiz-credit-memo-mobile__pagination-btn:hover:not(.is-disabled):not(:disabled) {
    border-color: #b0b0b0;
    background-color: #f5f5f5;
}

.wiz-credit-memo-mobile__pagination-btn.is-active {
    border-color: #8c8c8c;
    background-color: #e0e0e0;
    font-weight: 500;
}

.wiz-credit-memo-mobile__pagination-btn.is-disabled,
.wiz-credit-memo-mobile__pagination-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.wiz-credit-memo-mobile__pagination-btn svg {
    width: 24px;
    height: 24px;
    stroke: #2d2d2d;
}

.wiz-credit-memo-mobile__pagination-btn.is-disabled svg,
.wiz-credit-memo-mobile__pagination-btn:disabled svg {
    stroke: #b0b0b0;
}

.wiz-credit-memo-mobile__pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    color: #2d2d2d;
    font-size: 14px;
}

/* Loading — dim existing cards. No opaque grey overlay (that reads as a
   blank box). Pagination is disabled while the request is in flight. */
.wiz-credit-memo-mobile.is-loading .wiz-credit-memo-mobile__list {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.wiz-credit-memo-mobile.is-loading .wiz-credit-memo-mobile__pagination {
    opacity: 0.5;
    pointer-events: none;
}
