/* ===== لیست فاکتورها / لیست اسناد حسابداری ===== */

.rpl-table tbody tr {
    cursor: pointer;
}

.rpl-tick-col,
.rpl-check-cell {
    width: 46px;
    text-align: center;
}

.rpl-check-cell input[type="checkbox"],
.wad-list-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
    border: 1.5px solid #94a3b8;
    border-radius: 4px;
    background: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}

.rpl-check-cell input[type="checkbox"]:checked,
.wad-list-check input[type="checkbox"]:checked {
    background-color: #1e88e5;
    border-color: #1565c0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.2 8.2 6.4 11.4 12.8 4.6'/%3E%3C/svg%3E");
}

.rpl-check-cell input[type="checkbox"]:focus-visible,
.wad-list-check input[type="checkbox"]:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.rpl-kind-badge,
.rpl-taraz,
.rpl-table td,
.rpl-table td.rpl-text {
    direction: rtl;
    unicode-bidi: isolate;
    font-synthesis: none;
}

.rpl-table td.num {
    direction: ltr;
}

.rpl-table td.rpl-text {
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.rpl-table td.rpl-link,
.rpl-table td .rpl-link {
    color: #1565c0;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline dotted rgba(21, 101, 192, .45);
    text-underline-offset: 3px;
}

.rpl-table td.rpl-link:hover,
.rpl-table td .rpl-link:hover {
    color: #0d47a1;
}

.rpl-table td.rpl-bed {
    color: #004080;
}

.rpl-table td.rpl-bes {
    color: #800040;
}

.rpl-table td.rpl-net {
    color: #a80000;
    font-weight: 700;
}

.rpl-table tbody tr.selected td.rpl-link,
.rpl-table tbody tr.selected td .rpl-link,
.rpl-table tbody tr.selected td.rpl-bed,
.rpl-table tbody tr.selected td.rpl-bes,
.rpl-table tbody tr.selected td.rpl-net {
    color: inherit;
}

.rpl-kind-badge {
    display: inline-block;
    min-width: 82px;
    padding: 3px 8px;
    border-radius: 6px;
    background: #6b7280;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.rpl-kind-badge.is-kind-2 { background: #15803d; }
.rpl-kind-badge.is-kind-3 { background: #dc2626; }
.rpl-kind-badge.is-kind-4 { background: #1e88e5; }
.rpl-kind-badge.is-kind-5 { background: #7c3aed; }
.rpl-kind-badge.is-kind-6 { background: #9333ea; }
.rpl-kind-badge.is-kind-7 { background: #d97706; }
.rpl-kind-badge.is-kind-web { background: #0f766e; }

.rpl-type-label {
    color: #3d4a5c;
}

.rpl-taraz {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
}

.rpl-taraz.is-balanced {
    color: #15803d;
    background: rgba(21, 128, 61, .08);
    border-color: rgba(21, 128, 61, .25);
}

.rpl-taraz.is-note {
    color: #b45309;
    background: rgba(217, 119, 6, .1);
    border-color: rgba(217, 119, 6, .3);
}

.rpl-row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.rpl-row-actions .btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    border: 0;
}

.rpl-row-actions .btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.rpl-btn--blue { background: #1e88e5; }
.rpl-btn--green { background: #15803d; }
.rpl-btn--amber { background: #c27c0e; }
.rpl-btn--teal { background: #2f7f7a; }
.rpl-btn--olive { background: #7a7a3a; }

.rpl-row-actions .btn:not(:disabled):hover {
    filter: brightness(1.08);
}

.modal-collapse-toggle[data-action="toggle-collapse"] span {
    margin-right: 8px;
    font-size: 14px;
}

.rpl-summary .summary-value.rpl-net-value {
    color: #a80000;
}

@media print {
    .rpl-row-actions,
    .rpl-tick-col,
    .rpl-check-cell {
        display: none !important;
    }
}

body.rpt-document-printing .rpl-row-actions {
    display: none !important;
}

/* ===== مودال نمایش فاکتور / سند / رسید (فقط‌خواندنی) ===== */

.rrv-backdrop .rrv-modal {
    width: min(1280px, 100%);
    max-height: 94vh;
}

.rrv-modal [hidden] {
    display: none !important;
}

.rrv-modal .modal-modal-header {
    padding: 12px 16px;
}

.rrv-modal.has-kind-color .modal-modal-header {
    background: linear-gradient(135deg,
        var(--kind-color),
        color-mix(in srgb, var(--kind-color) 75%, #000));
}

.rrv-modal .modal-modal-body {
    padding: 12px;
    background: #f4f7fb;
}

.rrv-modal .accounting-document-card {
    min-height: 0;
    margin: 0;
}

.rrv-modal .accounting-document-body {
    padding: 12px;
    gap: 10px;
}

.rrv-modal .accounting-document-meta {
    padding: 10px 12px;
}

.rrv-modal .accounting-document-field .form-control[readonly] {
    background: #fff;
    color: var(--text);
    height: 38px;
}

.rrv-modal .accounting-document-field .form-control.rrv-num {
    direction: ltr;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.rrv-modal .invoice-customer-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .6rem 1rem;
    margin: 0;
    padding: .75rem 1rem;
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: 10px;
}

.rrv-modal .invoice-customer-meta .rrv-span-2 {
    grid-column: span 2;
}

.rrv-modal .accounting-document-table-container {
    height: auto;
    min-height: 120px;
    max-height: min(46vh, 460px);
}

.rrv-table {
    width: 100%;
    min-width: 980px;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.rrv-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 9px 6px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.rrv-modal.has-kind-color .rrv-table thead th {
    background: linear-gradient(135deg,
        var(--kind-color),
        color-mix(in srgb, var(--kind-color) 75%, #000));
}

.rrv-table tbody tr {
    background: #fff;
}

.rrv-table tbody tr:nth-child(even) {
    background: #fafcff;
}

.rrv-table tbody tr:hover td {
    background: #f1f7ff;
}

.rrv-table td {
    height: 42px;
    padding: 6px 8px;
    border-bottom: 1px solid #d8e0e8;
    border-left: 1px solid #e5e9ee;
    background: inherit;
    vertical-align: middle;
    text-align: center;
    font-size: 13px;
}

.rrv-table td.num {
    direction: ltr;
    text-align: left;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.rrv-table td.txt {
    text-align: right;
}

.rrv-table td.rrv-bed { color: #004080; }
.rrv-table td.rrv-bes { color: #800040; }

.rrv-table tbody tr.rrv-empty td {
    color: var(--text-light);
    height: 64px;
}

.rrv-section-title {
    margin: 4px 2px 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
}

.rrv-modal .invoice-footer {
    margin-top: 0;
}

.rrv-modal .accounting-document-summary {
    margin-top: 0;
}

.rrv-modal .rrv-status {
    padding: 28px 12px;
    text-align: center;
    color: var(--text-light);
    font-weight: 700;
}

.rrv-modal .rrv-status.is-error {
    color: #a12828;
}

.rrv-modal .modal-modal-footer {
    justify-content: flex-start;
    padding: 12px 16px;
}

.rrv-modal .modal-modal-footer .rrv-footer-spacer {
    flex: 1 1 auto;
}

@media (max-width: 768px) {
    .rrv-backdrop .rrv-modal {
        max-height: 100vh;
        border-radius: 0;
    }

    .rrv-modal .modal-modal-body {
        padding: 8px;
    }

    .rrv-modal .accounting-document-body {
        padding: 8px;
    }

    .rrv-modal .invoice-customer-meta .rrv-span-2 {
        grid-column: auto;
    }
}
