/* Payment receipt list + editor */

.payment-page .payment-party-meta {
    display: block;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
}

.payment-party-row {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(132px, 0.7fr);
    gap: 0.75rem 1rem;
    align-items: end;
}

.payment-party-account-field,
.payment-cost-field,
.payment-discount-field {
    min-width: 0;
}

.payment-lookup-field {
    display: flex;
    gap: 0.4rem;
    align-items: stretch;
}

.payment-lookup-field .form-control {
    flex: 1;
    min-width: 0;
}

.payment-lookup-field .form-control[readonly] {
    cursor: pointer;
}

.payment-lookup-field .btn,
.payment-lookup-field .modal-btn {
    min-width: 2.5rem;
    padding-inline: 0.6rem;
}

.payment-party-account-field .form-control {
    overflow: hidden;
    text-overflow: ellipsis;
}

.payment-tabs {
    display: flex;
    gap: 0.35rem;
    margin: 0.5rem 0 0.75rem;
    flex-wrap: wrap;
}

.payment-tab {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.payment-tab.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: transparent;
}

.payment-page.is-receive .payment-tab.is-active {
    background: linear-gradient(135deg, #2e9b3c, #1b7a2a);
}

.payment-page.is-pay .payment-tab.is-active {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
}

.payment-tab-panel[hidden] {
    display: none !important;
}

.payment-page {
    --payment-grid-height: min(56vh, 560px);
}

.payment-grid-shell {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.payment-grid-wrap {
    position: relative;
    height: var(--payment-grid-height);
    min-height: 220px;
    max-height: 85vh;
    margin: 0;
    overflow: auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px 10px 0 0;
    background: #fff;
    box-sizing: border-box;
    box-shadow: none;
}

.payment-resize-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 14px;
    cursor: ns-resize;
    user-select: none;
    touch-action: none;
    background: linear-gradient(to bottom, #f3f6fa, #e7eef5);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-top: none;
    border-radius: 0 0 10px 10px;
    color: #6b7c8c;
}

.payment-resize-handle::before {
    content: '';
    width: 42px;
    height: 4px;
    border-radius: 2px;
    background: #9aabba;
    box-shadow: 0 3px 0 #9aabba;
}

.payment-resize-handle:hover,
.payment-resize-handle:focus-visible,
.payment-resize-handle.is-dragging {
    outline: none;
    background: #d6e8f5;
}

.payment-resize-handle:hover::before,
.payment-resize-handle:focus-visible::before,
.payment-resize-handle.is-dragging::before {
    background: var(--primary, #1e88e5);
    box-shadow: 0 3px 0 var(--primary, #1e88e5);
}

body.payment-grid-resizing {
    cursor: ns-resize !important;
    user-select: none !important;
}

.payment-items-table {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
}

.payment-table-scroll-hint {
    display: none;
    margin: 0 0 8px;
    color: var(--text-light, #666);
    font-size: 12px;
}

.payment-items-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 0.7rem 0.55rem;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
}

.payment-page.is-receive .payment-items-table thead th {
    background: linear-gradient(135deg, #2e9b3c, #1b7a2a);
}

.payment-page.is-pay .payment-items-table thead th {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
}

.payment-items-table tbody td {
    padding: 0.28rem 0.45rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
    vertical-align: middle;
    font-size: 13px;
    line-height: 1.35;
    white-space: nowrap;
}

.payment-items-table tbody tr:nth-child(even) {
    background: #fafcff;
}

.payment-items-table tbody tr:hover {
    background: #f3f8ff;
}

.payment-cell-main,
.payment-cell-comment {
    text-align: right !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.payment-cell-money {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    direction: ltr;
}

.payment-row-actions-cell {
    width: 1%;
    white-space: nowrap;
    padding-inline: 0.35rem !important;
}

.payment-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    flex-wrap: nowrap;
}

.payment-row-action {
    height: 28px;
    border: 0;
    border-radius: 7px;
    padding: 0 0.7rem;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.payment-row-action.is-edit {
    background: rgba(21, 101, 192, 0.1);
    color: #1565c0;
}

.payment-row-action.is-edit:hover {
    background: rgba(21, 101, 192, 0.18);
}

.payment-row-action.is-delete {
    background: rgba(198, 40, 40, 0.08);
    color: #c62828;
}

.payment-row-action.is-delete:hover {
    background: rgba(198, 40, 40, 0.16);
}

.payment-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #64748b;
    font-size: 0.95rem;
    pointer-events: none;
}

.payment-empty[hidden] {
    display: none !important;
}

.payment-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0;
}

.payment-action-btn {
    min-width: 140px;
    font-weight: 700;
    color: #fff !important;
    border: none;
}

.payment-action-btn.is-cash {
    background: #2e9b3c;
}

.payment-action-btn.is-pos {
    background: #0f766e;
}

.payment-action-btn.is-check {
    background: #2563eb;
}

.payment-action-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.payment-footer {
    margin-top: 0.5rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
}

.payment-footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem 1rem;
    align-items: end;
}

.payment-footer-field label,
.payment-footer-field > span {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    color: #475569;
    font-weight: 700;
}

.payment-footer-field strong {
    display: block;
    min-height: 2.4rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    background: #0f172a;
    color: #fff;
    font-size: 0.95rem;
}

.payment-footer-total strong {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
}

.payment-page.is-receive .payment-footer-total strong {
    background: linear-gradient(135deg, #2e9b3c, #1b7a2a);
}

.payment-page.is-pay .payment-footer-total strong {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
}

.payment-discount-field .form-control {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.payment-kind-receive {
    color: #15803d;
    font-weight: 700;
}

.payment-kind-pay {
    color: #b91c1c;
    font-weight: 700;
}

/* Type picker */
.payment-type-modal {
    width: min(460px, 100%);
}

.payment-type-header {
    align-items: flex-start;
}

.payment-line-hint {
    margin: 0.25rem 0 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
}

.payment-type-body {
    padding: 1rem 1.1rem !important;
}

.payment-type-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.7rem;
}

.payment-type-card {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    text-align: right;
    cursor: pointer;
    font: inherit;
    color: #0f172a;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.payment-type-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.payment-type-card.is-selected {
    outline: none;
    transform: translateY(-1px);
}

.payment-type-card.is-receive.is-selected {
    border-color: #2e9b3c;
    box-shadow: 0 0 0 3px rgba(46, 155, 60, 0.16);
}

.payment-type-card.is-pay.is-selected {
    border-color: #d32f2f;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.16);
}

.payment-type-card__icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 12px;
}

.payment-type-card.is-receive .payment-type-card__icon {
    background: rgba(46, 155, 60, 0.12);
    color: #1b7a2a;
}

.payment-type-card.is-pay .payment-type-card__icon {
    background: rgba(211, 47, 47, 0.1);
    color: #b71c1c;
}

.payment-type-card__icon svg {
    width: 24px;
    height: 24px;
}

.payment-type-card__text {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.payment-type-card__text strong {
    font-size: 1rem;
}

.payment-type-card__text small {
    color: #64748b;
    font-size: 0.8rem;
}

.payment-type-card__key {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    font-weight: 800;
    font-size: 0.85rem;
}

/* Line modals */
.payment-line-modal {
    width: min(520px, calc(100vw - 24px));
}

.payment-line-header {
    align-items: flex-start;
}

.payment-line-close {
    min-width: 2.2rem;
    padding: 0.2rem 0.55rem;
    line-height: 1;
}

.payment-line-body {
    padding: 0.85rem 1rem 0.7rem !important;
}

.payment-line-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 0.85rem;
}

.payment-line-field label {
    display: block;
    margin-bottom: 0.22rem;
    font-weight: 700;
    color: #334155;
    font-size: 0.82rem;
}

.payment-line-span {
    grid-column: 1 / -1;
}

.payment-line-amount {
    font-weight: 800;
    letter-spacing: 0.02em;
}

.payment-line-account-name {
    background: #f8fafc;
}

.payment-line-message {
    margin-top: 0.65rem;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.85rem;
}

/* ===================================================================
   مودال ثبت چک — طرح «برگ چک» با تفکیک رنگی دریافتنی/پرداختنی
   =================================================================== */

.payment-check-modal {
    width: min(940px, calc(100vw - 24px));
    --chk-label-w: 116px;
    --chk-field-h: 38px;
    --chk-radius: 9px;
}

/* دریافتنی — کاغذ کاهی، لهجه سبز */
.payment-check-modal[data-pay-kind="1"] {
    --modal-primary: #2e7d32;
    --modal-primary-dark: #1b5e20;
    --chk-head-1: #2e9b3c;
    --chk-head-2: #1b6b28;
    --chk-paper-1: #f8f3d8;
    --chk-paper-2: #e9e1ab;
    --chk-edge: #cdc07d;
    --chk-ink: #3c340f;
    --chk-ink-soft: #6d6231;
    --chk-accent: #1f7a35;
    --chk-accent-soft: rgba(31, 122, 53, .16);
    --chk-watermark: rgba(120, 102, 34, .3);
}

/* پرداختنی — کاغذ گلبهی، لهجه قرمز */
.payment-check-modal[data-pay-kind="2"] {
    --modal-primary: #c62828;
    --modal-primary-dark: #8e1414;
    --chk-head-1: #d33a3a;
    --chk-head-2: #9c1717;
    --chk-paper-1: #fceded;
    --chk-paper-2: #eecfcf;
    --chk-edge: #dbaeae;
    --chk-ink: #3f2222;
    --chk-ink-soft: #7c5151;
    --chk-accent: #b02525;
    --chk-accent-soft: rgba(176, 37, 37, .14);
    --chk-watermark: rgba(148, 72, 72, .26);
}

/* ---------- سربرگ ---------- */
.chk-header {
    gap: 14px;
    padding: 14px 18px;
    border-bottom: none;
    background: linear-gradient(135deg, var(--chk-head-1), var(--chk-head-2));
}

.chk-header__text {
    flex: 1;
    min-width: 0;
}

.chk-header .modal-modal-title {
    font-size: 17px;
    letter-spacing: -.2px;
}

.chk-header__hint {
    margin: 3px 0 0;
    font-size: 11.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, .78);
}

.chk-kind-badge {
    flex: 0 0 auto;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .34);
    color: #fff;
    font-size: 12.5px;
    font-weight: 800;
    white-space: nowrap;
}

.chk-close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 9px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

.chk-close svg {
    width: 17px;
    height: 17px;
}

.chk-close:hover {
    background: rgba(255, 255, 255, .28);
}

.chk-close:active {
    transform: scale(.94);
}

/* ---------- بدنه و برگ چک ---------- */
.chk-body {
    padding: 14px !important;
    background: #eef0f3;
}

.chk-sheet {
    position: relative;
    overflow: hidden;
    padding: 16px 18px;
    border: 1px solid var(--chk-edge);
    border-radius: 14px;
    background:
        repeating-linear-gradient(115deg, rgba(255, 255, 255, .34) 0 2px, transparent 2px 7px),
        linear-gradient(150deg, var(--chk-paper-1), var(--chk-paper-2));
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .6) inset,
        0 10px 26px rgba(15, 23, 42, .1);
}

.chk-watermark {
    position: absolute;
    top: 57%;
    inset-inline-end: 4%;
    transform: translateY(-50%) rotate(-24deg);
    color: var(--chk-watermark);
    font-size: clamp(40px, 6.6vw, 66px);
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}

.chk-top,
.chk-grid,
.chk-perforation {
    position: relative;
    z-index: 1;
}

.chk-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 10px 22px;
    align-items: start;
}

.chk-col {
    display: grid;
    gap: 10px;
    align-content: start;
    min-width: 0;
}

/* ---------- نشان بانک ---------- */
.chk-brand {
    display: grid;
    justify-items: center;
    gap: 6px;
    width: 132px;
    padding-top: 2px;
    color: var(--chk-ink);
    opacity: .82;
}

.chk-brand__mark {
    width: 62px;
    height: 62px;
}

.chk-brand__caption {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    color: var(--chk-ink-soft);
}

/* ---------- جداکننده ---------- */
.chk-perforation {
    height: 2px;
    margin: 13px 0 12px;
    background: repeating-linear-gradient(to left,
        var(--chk-edge) 0 7px, transparent 7px 15px);
    opacity: .75;
}

/* ---------- شبکه فیلدها ---------- */
.chk-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 22px;
}

.chk-span {
    grid-column: 1 / -1;
}

.chk-field {
    display: grid;
    grid-template-columns: var(--chk-label-w) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chk-field > label,
.chk-label-static {
    justify-self: stretch;
    text-align: left;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--chk-ink);
}

.chk-field > label::after,
.chk-label-static::after {
    content: ' :';
}

.chk-control {
    min-width: 0;
}

/* ---------- ورودی‌ها ---------- */
.chk-input {
    width: 100%;
    height: var(--chk-field-h);
    min-width: 0;
    padding: 0 11px;
    border: 1px solid var(--chk-edge);
    border-radius: var(--chk-radius);
    background: #fff;
    color: #1f2937;
    font: inherit;
    font-size: 13.5px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05) inset;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.chk-input::placeholder {
    color: #a3a3a3;
}

.chk-input:hover:not([readonly]):not(:focus) {
    border-color: var(--chk-accent);
}

.chk-input:focus {
    outline: none;
    border-color: var(--chk-accent);
    box-shadow: 0 0 0 3px var(--chk-accent-soft);
}

.chk-input--num {
    direction: ltr;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
}

.chk-input[readonly] {
    background: rgba(255, 255, 255, .62);
    cursor: pointer;
}

/* تاریخ سررسید (ورودی سه‌بخشی) */
.chk-field--date .modal-date-input {
    max-width: 196px;
    height: var(--chk-field-h);
    padding: 0 8px;
    border-color: var(--chk-edge);
    border-radius: var(--chk-radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05) inset;
}

.chk-field--date .modal-date-input:focus-within {
    border-color: var(--chk-accent);
    box-shadow: 0 0 0 3px var(--chk-accent-soft);
}

.chk-field--date .modal-date-segment {
    font-size: 13.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* مبلغ */
.chk-control--amount {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.chk-input--amount {
    direction: ltr;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: .05em;
    color: #111827;
}

.chk-currency {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--chk-edge);
    border-radius: var(--chk-radius);
    background: rgba(255, 255, 255, .5);
    color: var(--chk-ink-soft);
    font-size: 12px;
    font-weight: 800;
}

/* انتخاب طرف حساب */
.chk-control--lookup {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.chk-control--lookup .chk-input {
    flex: 1;
}

.chk-pick {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: var(--chk-field-h);
    height: var(--chk-field-h);
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--chk-radius);
    background: linear-gradient(135deg, var(--chk-head-1), var(--chk-head-2));
    color: #fff;
    cursor: pointer;
    transition: filter .16s ease, transform .16s ease, box-shadow .16s ease;
}

.chk-pick svg {
    width: 18px;
    height: 18px;
}

.chk-pick:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 12px var(--chk-accent-soft);
}

.chk-pick:active {
    transform: scale(.95);
}

.chk-pick:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--chk-accent-soft);
}

/* ---------- خوانش «به حروف» ---------- */
.chk-field--readout {
    align-items: start;
}

.chk-field--readout .chk-label-static {
    padding-top: 3px;
}

.chk-words {
    min-height: 26px;
    padding: 3px 2px;
    border-bottom: 1px dashed var(--chk-edge);
    color: var(--chk-accent);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.65;
}

.chk-words--amount {
    font-size: 13px;
}

/* ---------- پیام خطا ---------- */
.chk-message {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 13px;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 13px;
    font-weight: 700;
}

.chk-message[hidden] {
    display: none;
}

/* ---------- پاورقی ---------- */
.chk-footer {
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
}

.chk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 152px;
    height: 44px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 11px;
    font: inherit;
    font-size: 14.5px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.chk-btn svg {
    width: 19px;
    height: 19px;
}

.chk-btn:active {
    transform: translateY(1px);
}

.chk-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, .18);
}

.chk-btn--confirm {
    background: linear-gradient(135deg, #24a94f, #137a33);
    color: #fff;
    box-shadow: 0 6px 16px rgba(19, 122, 51, .28);
}

.chk-btn--confirm:hover {
    box-shadow: 0 8px 22px rgba(19, 122, 51, .36);
}

.chk-btn--cancel {
    background: #fff;
    border-color: #f2cccc;
    color: #c0392b;
}

.chk-btn--cancel:hover {
    background: #fff5f5;
    border-color: #e8a6a6;
}

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 900px) {
    .payment-check-modal {
        --chk-label-w: 104px;
    }

    .chk-top {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .chk-brand {
        grid-row: 1;
        grid-column: 1 / -1;
        justify-self: center;
        order: -1;
    }
}

@media (max-width: 680px) {
    .chk-body {
        padding: 12px !important;
    }

    .chk-sheet {
        padding: 16px 14px 18px;
    }

    .chk-top,
    .chk-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .chk-span {
        grid-column: auto;
    }

    .chk-field {
        grid-template-columns: minmax(0, 1fr);
        gap: 5px;
    }

    .chk-field > label,
    .chk-label-static {
        text-align: right;
    }

    .chk-field--date .modal-date-input {
        max-width: none;
    }

    .chk-watermark {
        font-size: 52px;
        inset-inline-end: 2%;
    }

    .chk-footer {
        flex-direction: column-reverse;
    }

    .chk-btn {
        width: 100%;
    }

    .chk-input,
    .chk-input--amount {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chk-btn,
    .chk-pick,
    .chk-close,
    .chk-input {
        transition: none;
    }
}

@media (max-width: 960px) {
    .payment-party-row {
        grid-template-columns: minmax(0, 1.5fr) minmax(140px, 0.8fr);
    }

    .payment-party-account-field {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .payment-table-scroll-hint {
        display: block;
    }

    .payment-items-table {
        min-width: 640px;
    }

    .payment-grid-wrap {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .payment-action-buttons {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .payment-action-btn {
        width: 100%;
        min-height: 44px;
    }

    /* ستون حساب/مبلغ چسبان */
    .payment-items-table th:nth-child(2),
    .payment-items-table td:nth-child(2) {
        position: sticky;
        right: 44px;
        z-index: 3;
        background: #fff;
        box-shadow: -6px 0 10px -6px rgba(15, 23, 42, .16);
    }

    .payment-items-table thead th:nth-child(2) {
        z-index: 12;
        color: #fff;
    }

    .payment-page.is-receive .payment-items-table thead th:nth-child(2) {
        background: linear-gradient(135deg, #2e9b3c, #1b7a2a);
    }

    .payment-page.is-pay .payment-items-table thead th:nth-child(2) {
        background: linear-gradient(135deg, #d32f2f, #b71c1c);
    }

    .payment-items-table th:nth-child(1),
    .payment-items-table td:nth-child(1) {
        position: sticky;
        right: 0;
        z-index: 4;
        background: #fff;
        box-shadow: -6px 0 10px -6px rgba(15, 23, 42, .2);
    }

    .payment-items-table thead th:nth-child(1) {
        z-index: 13;
        color: #fff;
    }

    .payment-page.is-receive .payment-items-table thead th:nth-child(1) {
        background: linear-gradient(135deg, #2e9b3c, #1b7a2a);
    }

    .payment-page.is-pay .payment-items-table thead th:nth-child(1) {
        background: linear-gradient(135deg, #d32f2f, #b71c1c);
    }

    .payment-items-table tbody tr:nth-child(even) td:nth-child(1),
    .payment-items-table tbody tr:nth-child(even) td:nth-child(2) {
        background: #fafcff;
    }

    .payment-items-table tbody tr:hover td:nth-child(1),
    .payment-items-table tbody tr:hover td:nth-child(2) {
        background: #f3f8ff;
    }
}

@media (max-width: 768px) {
    .payment-resize-handle {
        display: none;
    }

    .payment-grid-wrap {
        height: min(48dvh, 420px);
        max-height: none;
        border-radius: 10px;
    }

    .payment-items-table {
        min-width: 580px;
    }

    .payment-items-table thead th {
        font-size: 12px;
        padding: 0.55rem 0.4rem;
    }

    .payment-items-table tbody td {
        font-size: 13px;
        padding: 0.35rem 0.35rem;
    }

    .payment-lookup-field .btn {
        min-width: 44px;
        min-height: 44px;
    }

    .payment-tabs {
        gap: 6px;
    }

    .payment-tab {
        flex: 1 1 0;
        min-height: 44px;
        font-size: 13px;
    }

    .payment-footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.65rem;
    }

    .payment-meta input,
    .payment-meta select,
    .payment-items-table input,
    .payment-items-table select {
        font-size: 16px !important;
    }
}

@media (max-width: 720px) {
    .payment-party-row,
    .payment-line-grid {
        grid-template-columns: 1fr;
    }

    .payment-party-account-field,
    .payment-line-span {
        grid-column: auto;
    }
}

@media (max-width: 480px) {
    .payment-footer-grid {
        grid-template-columns: 1fr;
    }

    .payment-items-table {
        min-width: 520px;
    }
}
