/* The reconciliation kit: the status band, tiles, flags, chips, tables and dialog parts the QR
   reconciliation pages, the cash journal and their dialogs share, in the look of the card settlement
   page. Global rather than scoped because a dozen components draw these same parts with their own
   markup, and a scoped sheet reaches only the one component that owns it. */

/* ------------------------------------------------------------- surfaces */

.rk-card {
    background: var(--tblr-bg-surface, #fff);
    border: 1px solid var(--tblr-border-color, #e2e8f0);
    border-radius: 10px;
    min-width: 0;
}

.rk-head {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .375rem 1rem;
    justify-content: space-between;
    min-height: 1.75rem;
}

.rk-title {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .625rem;
    min-width: 0;
}

.rk-title h2,
.rk-title h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.rk-sub {
    color: var(--tblr-secondary-color, #64748b);
    font-size: .8125rem;
}

.rk-logo {
    align-items: center;
    background-color: var(--tblr-bg-surface, #fff);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    border: 1px solid var(--tblr-border-color, #e2e8f0);
    border-radius: 10px;
    color: var(--tblr-secondary-color, #64748b);
    display: flex;
    flex-shrink: 0;
    font-size: 1.5rem;
    height: 3.25rem;
    justify-content: center;
    width: 3.25rem;
}

.rk-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}

.rk-actions .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ------------------------------------------------------------- the status band */

.rk-band {
    display: flex;
    flex-direction: column;
    gap: .875rem;
    padding: 1rem 1.25rem;
}

.rk-tiles {
    align-items: stretch;
    display: grid;
    gap: .625rem;
}

.rk-op {
    align-self: center;
    color: var(--tblr-secondary-color, #64748b);
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
}

.rk-tile {
    background: var(--tblr-bg-surface-secondary, #f7f8fa);
    border: 1px solid var(--tblr-border-color, #e2e8f0);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: .125rem;
    min-width: 0;
    padding: .75rem .875rem;
}

.rk-tile.is-good {
    background: rgba(47, 158, 68, .07);
    border-color: rgba(47, 158, 68, .3);
}

.rk-tile.is-info {
    background: rgba(32, 107, 196, .06);
    border-color: rgba(32, 107, 196, .25);
}

.rk-tile.is-warn {
    background: rgba(217, 164, 65, .08);
    border-color: rgba(217, 164, 65, .5);
}

.rk-tile.is-bad {
    background: rgba(214, 57, 57, .06);
    border-color: rgba(214, 57, 57, .35);
}

.rk-tile.is-pending {
    background: var(--tblr-bg-surface, #fff);
    border-style: dashed;
}

.rk-label,
.rk-note {
    color: var(--tblr-secondary-color, #64748b);
    font-size: .8125rem;
    line-height: 1.125rem;
    min-height: 1.125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rk-label .ti {
    margin-right: .375rem;
}

.rk-value {
    align-items: center;
    display: flex;
    font-size: 1.375rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    height: 2rem;
    overflow: hidden;
    white-space: nowrap;
}

.rk-tile.is-good .rk-value {
    color: #2b8a3e;
}

.rk-tile.is-info .rk-value {
    color: var(--tblr-primary, #206bc4);
}

.rk-tile.is-warn .rk-value {
    color: #b45309;
}

.rk-tile.is-bad .rk-value {
    color: #c0342b;
}

.rk-tile.is-pending .rk-value {
    color: var(--tblr-secondary-color, #64748b);
}

.rk-split {
    display: flex;
    font-size: .8125rem;
    justify-content: space-between;
    line-height: 1.375rem;
}

.rk-split b {
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------- flags, chips and pills */

.rk-flag,
.rk-pill,
.rk-chip {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-weight: 600;
    gap: .25rem;
    white-space: nowrap;
}

.rk-flag {
    font-size: .8125rem;
    height: 1.5rem;
    padding: 0 .625rem;
}

.rk-pill {
    font-size: .75rem;
    height: 1.375rem;
    padding: 0 .5rem;
}

.rk-chip {
    background: var(--tblr-bg-surface-secondary, #eef1f5);
    color: inherit;
    font-size: .8125rem;
    height: 1.5rem;
    padding: 0 .625rem;
    text-decoration: none;
}

.rk-chips {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.is-good.rk-flag, .is-good.rk-pill, .is-good.rk-chip {
    background: rgba(47, 158, 68, .12);
    color: #2b8a3e;
}

.is-info.rk-flag, .is-info.rk-pill, .is-info.rk-chip {
    background: rgba(32, 107, 196, .1);
    color: var(--tblr-primary, #206bc4);
}

.is-warn.rk-flag, .is-warn.rk-pill, .is-warn.rk-chip {
    background: rgba(217, 164, 65, .16);
    color: #8a4a06;
}

.is-bad.rk-flag, .is-bad.rk-pill, .is-bad.rk-chip {
    background: rgba(214, 57, 57, .1);
    color: #c0342b;
}

.is-purple.rk-pill {
    background: rgba(174, 62, 201, .1);
    color: #7b2c91;
}

.is-muted.rk-flag, .is-muted.rk-pill, .is-muted.rk-chip {
    background: var(--tblr-bg-surface-secondary, #eef1f5);
    color: var(--tblr-secondary-color, #64748b);
}

/* ------------------------------------------------------------- tables */

.rk-table {
    margin: 0;
}

/* the scroll box holds its table's screen-reader labels too: without it a visually-hidden heading is
   placed against the page and widens it past the screen */
.rk-card .table-responsive,
.rdg-list {
    position: relative;
}

.rk-table thead th {
    background: var(--tblr-bg-surface-secondary, #f7f8fa);
    color: var(--tblr-secondary-color, #64748b);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: none;
    white-space: nowrap;
}

.rk-table th,
.rk-table td {
    padding: .5rem .75rem;
    vertical-align: middle;
}

.rk-table tbody tr {
    height: 3.25rem;
}

.rk-table tfoot td {
    background: var(--tblr-bg-surface-secondary, #f7f8fa);
    font-weight: 700;
}

.rk-num {
    font-variant-numeric: tabular-nums;
    text-align: end;
    white-space: nowrap;
}

.rk-strong {
    font-weight: 600;
}

.rk-muted {
    color: var(--tblr-secondary-color, #64748b);
}

.rk-small {
    font-size: .75rem;
}

.rk-stack {
    display: flex;
    flex-direction: column;
    line-height: 1.125rem;
    min-width: 0;
}

.rk-go {
    align-items: center;
    border: 1px solid var(--tblr-border-color, #d5dbe4);
    border-radius: 8px;
    color: var(--tblr-secondary-color, #64748b);
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    width: 2rem;
}

.rk-go:hover,
.rk-go:focus-visible {
    border-color: var(--tblr-primary, #206bc4);
    color: var(--tblr-primary, #206bc4);
}

.rk-link {
    background: none;
    border: 0;
    color: var(--tblr-link-color, #206bc4);
    padding: 0;
}

.rk-link:hover {
    text-decoration: underline;
}

.rk-foot-note {
    align-items: center;
    border-top: 1px solid var(--tblr-border-color, #e2e8f0);
    color: var(--tblr-secondary-color, #64748b);
    display: flex;
    flex-wrap: wrap;
    font-size: .8125rem;
    gap: .5rem;
    padding: .75rem 1.25rem;
}

.rk-empty {
    align-items: center;
    color: var(--tblr-secondary-color, #64748b);
    display: flex;
    font-size: .875rem;
    gap: .5rem;
    justify-content: center;
    min-height: 3.25rem;
    padding: .75rem 1rem;
}

/* ------------------------------------------------------------- dialogs */

.rdg {
    display: flex;
    flex-direction: column;
    gap: .875rem;
}

.rdg-sub {
    color: var(--tblr-secondary-color, #64748b);
    font-size: .8125rem;
    margin: -.25rem 0 0;
}

.rdg-facts {
    background: var(--tblr-bg-surface-secondary, #f7f8fa);
    border: 1px solid var(--tblr-border-color, #e2e8f0);
    border-radius: 8px;
    display: grid;
    gap: .5rem 1rem;
    grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
    padding: .625rem .875rem;
}

.rdg-fact {
    display: flex;
    flex-direction: column;
    font-size: .8125rem;
    min-width: 0;
}

.rdg-fact span {
    color: var(--tblr-secondary-color, #64748b);
}

.rdg-fact b {
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rdg-fields {
    display: grid;
    gap: .75rem 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rdg-field {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    min-width: 0;
}

.rdg-field > label,
.rdg-field > .rdg-field-label {
    font-size: .875rem;
    font-weight: 600;
    margin: 0;
}

.rdg-field small {
    color: var(--tblr-secondary-color, #64748b);
    font-size: .75rem;
}

.rdg-field .rdg-error,
.rdg-error {
    color: #c0342b;
    font-size: .75rem;
}

.rdg-field .is-invalid,
.rdg-field .is-invalid .form-control {
    border-color: #d63939;
}

.rdg-preview {
    background: rgba(32, 107, 196, .06);
    border: 1px solid rgba(32, 107, 196, .2);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: .375rem;
    padding: .75rem .875rem;
}

.rdg-preview.is-warn {
    background: rgba(217, 164, 65, .08);
    border-color: rgba(217, 164, 65, .45);
}

.rdg-preview.is-bad {
    background: rgba(214, 57, 57, .06);
    border-color: rgba(214, 57, 57, .3);
}

.rdg-preview.is-good {
    background: rgba(47, 158, 68, .07);
    border-color: rgba(47, 158, 68, .3);
}

.rdg-preview-title {
    align-items: center;
    color: var(--tblr-primary, #206bc4);
    display: flex;
    font-size: .75rem;
    font-weight: 700;
    gap: .375rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.rdg-preview.is-warn .rdg-preview-title {
    color: #b45309;
}

.rdg-preview.is-bad .rdg-preview-title {
    color: #c0342b;
}

.rdg-preview.is-good .rdg-preview-title {
    color: #2b8a3e;
}

.rdg-line {
    align-items: baseline;
    display: flex;
    font-size: .875rem;
    gap: 1rem;
    justify-content: space-between;
}

.rdg-line > span {
    min-width: 0;
}

.rdg-line > b {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rdg-section {
    align-items: center;
    display: flex;
    font-size: .875rem;
    font-weight: 600;
    gap: .5rem;
    justify-content: space-between;
    margin-bottom: -.375rem;
}

.rdg-list {
    border: 1px solid var(--tblr-border-color, #e2e8f0);
    border-radius: 8px;
    overflow-x: auto;
}

.rdg-list .table {
    margin: 0;
}

.rdg-list .table thead th {
    background: var(--tblr-bg-surface-secondary, #f7f8fa);
    color: var(--tblr-secondary-color, #64748b);
    font-size: .75rem;
    font-weight: 600;
    text-transform: none;
    white-space: nowrap;
}

.rdg-list .table td {
    vertical-align: middle;
}

.rdg-list .table tbody tr {
    height: 2.875rem;
}

/* a row the reader picks: a radio when one may be picked, a box when several may */
.rdg-row {
    cursor: pointer;
}

.rdg-row:hover {
    background: var(--tblr-bg-surface-secondary, #f7f8fa);
}

.rdg-row.is-picked {
    background: rgba(32, 107, 196, .07);
    box-shadow: inset 3px 0 0 var(--tblr-primary, #206bc4);
}

.rdg-row:focus-visible {
    outline: 2px solid var(--tblr-primary, #206bc4);
    outline-offset: -2px;
}

.rdg-mark {
    align-items: center;
    border: 1.5px solid var(--tblr-border-color, #c3cad5);
    border-radius: 999px;
    color: transparent;
    display: inline-flex;
    font-size: .75rem;
    height: 1.125rem;
    justify-content: center;
    width: 1.125rem;
}

.rdg-mark.is-box {
    border-radius: 4px;
}

.rdg-mark.is-on {
    background: var(--tblr-primary, #206bc4);
    border-color: var(--tblr-primary, #206bc4);
    color: #fff;
}

.rdg-desc {
    max-width: 20rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .rdg-desc {
        max-width: 9rem;
    }
}

.rdg-foot {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* a button keeps its label whole: when the foot runs out of room the buttons wrap to a new line instead of
   squeezing their text over each other */
.modal-footer.rdg-foot {
    flex-wrap: wrap;
}

.rdg-foot > .btn {
    flex: 0 0 auto;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* phones: Tabler stretches footer buttons from a zero basis, which squeezes them onto one line; grown from
   their own width instead, they fill the line and wrap */
@media (max-width: 575.98px) {
    .modal-footer.rdg-foot > .btn {
        flex: 1 0 auto;
    }
}

.rdg-why {
    align-items: center;
    color: var(--tblr-secondary-color, #64748b);
    display: inline-flex;
    font-size: .8125rem;
    gap: .375rem;
    margin-right: auto;
}

.rdg-person {
    align-items: center;
    display: flex;
    gap: .75rem;
}

.rdg-person .avatar {
    border-radius: 8px;
    flex-shrink: 0;
    height: 2.75rem;
    width: 2.75rem;
}

.rdg-person b {
    display: block;
    font-size: .9375rem;
}

.rdg-person small {
    color: var(--tblr-secondary-color, #64748b);
}

.rdg-done {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: .375rem;
    padding: 1.5rem 0 .75rem;
    text-align: center;
}

.rdg-done-icon {
    align-items: center;
    background: rgba(47, 158, 68, .12);
    border-radius: 999px;
    color: #2b8a3e;
    display: flex;
    font-size: 1.75rem;
    height: 3.5rem;
    justify-content: center;
    width: 3.5rem;
}

.rdg-done b {
    font-size: 1rem;
}

.rdg-done small {
    color: var(--tblr-secondary-color, #64748b);
}

.rdg-tiles {
    display: grid;
    gap: .625rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 575.98px) {
    .rdg-fields,
    .rdg-tiles {
        grid-template-columns: minmax(0, 1fr);
    }

    .rdg-foot .btn {
        flex: 1;
    }

    .rdg-why {
        flex-basis: 100%;
    }
}

/* ------------------------------------------------------------- narrow screens */

@media (max-width: 767.98px) {
    .rk-band {
        padding: .875rem 1rem;
    }

    .rk-tiles {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .rk-op {
        display: none;
    }

    .rk-tile {
        align-items: center;
        column-gap: .75rem;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        padding: .5rem .75rem;
    }

    .rk-tile .rk-label {
        grid-column: 1;
        grid-row: 1;
    }

    .rk-tile .rk-note {
        grid-column: 1;
        grid-row: 2;
    }

    .rk-tile .rk-value {
        font-size: 1.125rem;
        grid-column: 2;
        grid-row: 1 / span 2;
        height: auto;
    }

    .rk-tile > .rk-split,
    .rk-tile > .rk-tile-wide {
        grid-column: 1 / -1;
    }

    .rk-table th,
    .rk-table td {
        padding-left: .5rem;
        padding-right: .5rem;
    }
}

/* ------------------------------------------------------------- dark theme: the amber and red text shades
   that read on white are too dark on the dark surface */

[data-bs-theme="dark"] .is-warn.rk-flag,
[data-bs-theme="dark"] .is-warn.rk-pill,
[data-bs-theme="dark"] .is-warn.rk-chip,
[data-bs-theme="dark"] .rk-tile.is-warn .rk-value,
[data-bs-theme="dark"] .rdg-preview.is-warn .rdg-preview-title {
    color: #f59f00;
}

[data-bs-theme="dark"] .is-bad.rk-flag,
[data-bs-theme="dark"] .is-bad.rk-pill,
[data-bs-theme="dark"] .is-bad.rk-chip,
[data-bs-theme="dark"] .rk-tile.is-bad .rk-value,
[data-bs-theme="dark"] .rdg-error {
    color: #ff6b6b;
}

[data-bs-theme="dark"] .is-good.rk-flag,
[data-bs-theme="dark"] .is-good.rk-pill,
[data-bs-theme="dark"] .rk-tile.is-good .rk-value {
    color: #51cf66;
}
