.ym-dashboard {
    display: grid;
    gap: 14px;
}

.ym-dashboard__cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.ym-dashboard-stat {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    border: 1px solid hsl(var(--border));
    border-radius: 11px;
    background: #fff;
    padding: 13px 14px;
    color: hsl(var(--foreground));
    box-shadow: 0 12px 34px rgba(15, 23, 42, .055);
    transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.ym-dashboard-stat:hover {
    color: hsl(var(--foreground));
    border-color: rgba(37, 99, 235, .28);
    box-shadow: 0 16px 38px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}

.ym-dashboard-stat__icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
}

.ym-dashboard-stat__body {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.ym-dashboard-stat__body small,
.ym-dashboard-stat__body em {
    display: block;
    overflow: hidden;
    color: hsl(var(--muted-foreground));
    font-size: 10.6px;
    font-style: normal;
    font-weight: 750;
    line-height: 1.22;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ym-dashboard-stat__body strong {
    display: block;
    overflow: hidden;
    color: hsl(var(--foreground));
    font-size: 18px;
    font-weight: 900;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ym-dashboard-stat--sales .ym-dashboard-stat__icon {
    background: #2f7fbc;
}

.ym-dashboard-stat--profit .ym-dashboard-stat__icon {
    background: #16a34a;
}

.ym-dashboard-stat--receipts .ym-dashboard-stat__icon {
    background: #f59e0b;
}

.ym-dashboard-stat--debt .ym-dashboard-stat__icon {
    background: #dc2626;
}

.ym-dashboard-stat--stock .ym-dashboard-stat__icon {
    background: #6d5dfc;
}

.ym-dashboard__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, .95fr);
    gap: 14px;
}

.ym-dashboard-card {
    overflow: hidden;
    border: 1px solid hsl(var(--border));
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 12px 34px rgba(15, 23, 42, .052);
}

.ym-dashboard-card__head {
    display: flex;
    min-height: 58px;
    align-items: center;
    gap: 11px;
    border-bottom: 1px solid hsl(var(--border));
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(37, 99, 235, .035), transparent 54%), #fff;
}

.ym-dashboard-card__head > span:nth-child(2) {
    display: grid;
    min-width: 0;
    flex: 1 1 auto;
    gap: 2px;
}

.ym-dashboard-card__head strong {
    color: hsl(var(--foreground));
    font-size: 13.5px;
    font-weight: 900;
    line-height: 1.15;
}

.ym-dashboard-card__head small {
    overflow: hidden;
    color: hsl(var(--muted-foreground));
    font-size: 11px;
    font-weight: 650;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ym-dashboard-card__icon {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid hsl(var(--border));
    border-radius: 9px;
    background: #f8fbff;
    color: #26435f;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .04);
}

.ym-dashboard-table-wrap {
    min-width: 0;
    overflow-x: auto;
}

.ym-dashboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ym-dashboard-table th,
.ym-dashboard-table td {
    border-bottom: 1px solid #dde5ef;
    padding: 9px 12px;
    color: hsl(var(--foreground));
    font-size: 11.7px;
    line-height: 1.25;
    vertical-align: middle;
}

.ym-dashboard-table th {
    background: #f4f6fa;
    color: #617086;
    font-size: 10.5px;
    font-weight: 860;
    letter-spacing: .045em;
    text-align: left;
    text-transform: uppercase;
}

.ym-dashboard-table tfoot th,
.ym-dashboard-table tfoot td {
    background: #f7f9fc;
    font-size: 11.8px;
    font-weight: 850;
}

.ym-dashboard-table small {
    display: block;
    margin-top: 2px;
    color: hsl(var(--muted-foreground));
    font-size: 10.5px;
    font-weight: 650;
}

.ym-dashboard-table--compact td:last-child,
.ym-dashboard-table--compact th:last-child,
.ym-dashboard-money {
    text-align: right;
    white-space: nowrap;
}

.ym-dashboard-table--stock {
    min-width: 620px;
}

.ym-dashboard-stock-photo-col,
.ym-dashboard-stock-photo {
    width: 58px;
    text-align: center;
}

.ym-dashboard-stock-photo .ym-dashboard-thumb {
    margin: 0 auto;
}

.ym-dashboard-stock-title {
    min-width: 0;
}

.ym-dashboard-stock-title .ym-product-title-with-link {
    min-width: 0;
}

.ym-dashboard-stock-title .ym-product-title-text {
    overflow: hidden;
    max-width: 520px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ym-dashboard-link {
    color: #0b67f5;
    font-weight: 760;
}

.ym-dashboard-link i {
    margin-right: 4px;
    color: #00a5b5;
    font-size: 10px;
}

.ym-dashboard-debtor {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
}

.ym-dashboard-pay-button {
    display: inline-flex;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(14, 165, 233, .22);
    border-radius: 999px;
    background: #ecfeff;
    color: #0891b2;
    font-size: 11px;
    transition: border-color .12s ease, background .12s ease, color .12s ease, transform .12s ease;
}

.ym-dashboard-pay-button:hover {
    border-color: rgba(14, 165, 233, .42);
    background: #cffafe;
    color: #0369a1;
    transform: translateY(-1px);
}

.ym-dashboard-money {
    font-weight: 820;
}

.ym-dashboard-money--success {
    color: #138a42 !important;
}

.ym-dashboard-money--danger {
    color: #d42424 !important;
}

.ym-dashboard-qty {
    color: #12a077;
    font-weight: 880;
    text-align: center;
    white-space: nowrap;
}

.ym-dashboard-product {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}

.ym-dashboard-product > span:last-child {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.ym-dashboard-product .ym-product-title-with-link {
    min-width: 0;
}

.ym-dashboard-product .ym-product-title-text {
    overflow: hidden;
    max-width: 280px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ym-dashboard-thumb {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    background: #fff;
}

.ym-dashboard-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ym-dashboard-thumb--empty {
    background: #f3f6fb;
    color: #6a7890;
}

.ym-dashboard-empty {
    padding: 22px 12px !important;
    color: hsl(var(--muted-foreground)) !important;
    font-weight: 650;
    text-align: center;
}

.ym-modal--dashboard-payment .ym-modal__dialog {
    width: min(560px, calc(100% - 24px));
    border-radius: 14px;
}

.ym-modal--dashboard-payment .ym-modal__content {
    padding: 0;
}

.ym-dashboard-payment {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.ym-dashboard-payment__head {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    padding-right: 36px;
}

.ym-dashboard-payment__icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    background: #f8fbff;
    color: #0b1a33;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}

.ym-dashboard-payment__head span:last-child {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.ym-dashboard-payment__head strong {
    color: hsl(var(--foreground));
    font-size: 17px;
    font-weight: 900;
    line-height: 1.1;
}

.ym-dashboard-payment__head small {
    overflow: hidden;
    color: hsl(var(--muted-foreground));
    font-size: 11.2px;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ym-dashboard-payment__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    background: #fbfcff;
    padding: 14px;
}

.ym-dashboard-payment__field {
    display: grid;
    gap: 5px;
    margin: 0;
}

.ym-dashboard-payment__field--full {
    grid-column: 1 / -1;
}

.ym-dashboard-payment__field span {
    color: hsl(var(--muted-foreground));
    font-size: 10.8px;
    font-weight: 800;
}

.ym-dashboard-payment__field .form-control {
    min-height: 36px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 650;
}

.ym-dashboard-payment__field textarea.form-control {
    min-height: 76px;
}

.ym-dashboard-payment__result {
    display: none;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 11.2px;
    font-weight: 750;
}

.ym-dashboard-payment__result.is-success {
    display: block;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #15803d;
}

.ym-dashboard-payment__result.is-error {
    display: block;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.ym-dashboard-payment__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 1200px) {
    .ym-dashboard__cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ym-dashboard__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .ym-dashboard {
        gap: 10px;
    }

    .ym-dashboard__cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .ym-dashboard-stat {
        min-height: 68px;
        align-items: flex-start;
        gap: 8px;
        border-radius: 10px;
        padding: 9px;
        box-shadow: 0 8px 22px rgba(15, 23, 42, .045);
    }

    .ym-dashboard-stat:nth-child(5) {
        grid-column: 1 / -1;
    }

    .ym-dashboard-stat__icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        border-radius: 8px;
        font-size: 12px;
    }

    .ym-dashboard-stat__body {
        gap: 1px;
    }

    .ym-dashboard-stat__body small,
    .ym-dashboard-stat__body em {
        font-size: 9.8px;
        white-space: normal;
    }

    .ym-dashboard-stat__body strong {
        font-size: 15px;
        white-space: normal;
    }

    .ym-dashboard__grid {
        gap: 10px;
    }

    .ym-dashboard-card {
        border-radius: 10px;
        box-shadow: 0 8px 22px rgba(15, 23, 42, .045);
    }

    .ym-dashboard-card__head {
        min-height: 48px;
        align-items: center;
        gap: 9px;
        padding: 8px 10px;
    }

    .ym-dashboard-card__head strong {
        font-size: 12.5px;
    }

    .ym-dashboard-card__icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        border-radius: 8px;
        font-size: 12px;
    }

    .ym-dashboard-table-wrap {
        overflow: visible;
    }

    .ym-dashboard-table th,
    .ym-dashboard-table td {
        padding: 7px 9px;
        font-size: 11.2px;
    }

    .ym-dashboard-table th {
        font-size: 9.8px;
    }

    .ym-dashboard-table--compact {
        table-layout: fixed;
    }

    .ym-dashboard-table--compact td:first-child,
    .ym-dashboard-table--compact th:first-child {
        width: 62%;
    }

    .ym-dashboard-debtor {
        gap: 6px;
    }

    .ym-dashboard-pay-button {
        width: 20px;
        height: 20px;
        flex-basis: 20px;
        font-size: 10px;
    }

    .ym-dashboard-table--stock {
        min-width: 0;
    }

    .ym-dashboard-table--stock,
    .ym-dashboard-table--stock tbody,
    .ym-dashboard-table--stock tfoot {
        display: block;
        width: 100%;
    }

    .ym-dashboard-table--stock thead {
        display: none;
    }

    .ym-dashboard-table--stock tbody tr {
        display: grid;
        grid-template-columns: 32px repeat(3, minmax(0, 1fr));
        gap: 8px 10px;
        border-bottom: 1px solid #dde5ef;
        padding: 10px;
    }

    .ym-dashboard-table--stock td {
        display: grid;
        min-width: 0;
        gap: 2px;
        border: 0;
        padding: 0;
        text-align: left;
    }

    .ym-dashboard-table--stock td:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
        align-self: start;
    }

    .ym-dashboard-table--stock td:nth-child(2) {
        grid-column: 2 / -1;
        grid-row: 1;
    }

    .ym-dashboard-table--stock td:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
    }

    .ym-dashboard-table--stock td:nth-child(4) {
        grid-column: 3;
        grid-row: 2;
    }

    .ym-dashboard-table--stock td:nth-child(5) {
        grid-column: 4;
        grid-row: 2;
    }

    .ym-dashboard-table--stock td:nth-child(3)::before {
        content: "К-во";
    }

    .ym-dashboard-table--stock td:nth-child(4)::before {
        content: "Себест.";
    }

    .ym-dashboard-table--stock td:nth-child(5)::before {
        content: "Цена";
    }

    .ym-dashboard-table--stock td:nth-child(3)::before,
    .ym-dashboard-table--stock td:nth-child(4)::before,
    .ym-dashboard-table--stock td:nth-child(5)::before {
        color: hsl(var(--muted-foreground));
        font-size: 9.6px;
        font-weight: 850;
        letter-spacing: .045em;
        line-height: 1;
        text-transform: uppercase;
    }

    .ym-dashboard-product {
        gap: 8px;
    }

    .ym-dashboard-product .ym-product-title-text {
        max-width: none;
        white-space: normal;
    }

    .ym-dashboard-thumb {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }

    .ym-dashboard-stock-title .ym-product-title-text {
        max-width: none;
        white-space: normal;
    }

    .ym-dashboard-qty,
    .ym-dashboard-money {
        text-align: left;
    }

    .ym-dashboard-table--stock tfoot tr {
        display: grid;
        grid-template-columns: 1fr auto auto;
        gap: 8px;
        align-items: center;
        background: #f7f9fc;
        padding: 10px;
    }

    .ym-dashboard-table--stock tfoot th {
        display: block;
        border: 0;
        padding: 0;
    }

    .ym-dashboard-table--stock tfoot th:nth-child(3) {
        grid-column: 3;
        text-align: right;
    }

    .ym-dashboard-table--stock tfoot th:nth-child(4) {
        display: none;
    }

    .ym-dashboard-payment__grid {
        grid-template-columns: 1fr;
    }

    .ym-modal--dashboard-payment .ym-modal__dialog {
        width: min(100% - 16px, 560px);
        max-height: calc(100vh - 16px);
        margin: 8px auto;
        border-radius: 12px;
    }

    .ym-modal--dashboard-payment .ym-modal__content {
        max-height: calc(100vh - 16px);
    }

    .ym-dashboard-payment {
        gap: 10px;
        padding: 14px;
    }

    .ym-dashboard-payment__head {
        gap: 9px;
    }

    .ym-dashboard-payment__icon {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 10px;
    }

    .ym-dashboard-payment__head strong {
        font-size: 15px;
    }

    .ym-dashboard-payment__head small {
        white-space: normal;
    }

    .ym-dashboard-payment__grid {
        gap: 9px;
        border-radius: 10px;
        padding: 10px;
    }

    .ym-dashboard-payment__field textarea.form-control {
        min-height: 68px;
    }

    .ym-dashboard-payment__actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }
}

@media (max-width: 360px) {
    .ym-dashboard__cards {
        grid-template-columns: 1fr;
    }

    .ym-dashboard-stat:nth-child(5) {
        grid-column: auto;
    }

    .ym-dashboard-table--stock tbody tr {
        grid-template-columns: 30px repeat(3, minmax(0, 1fr));
        gap: 7px 8px;
    }

    .ym-dashboard-table--stock td:nth-child(2) {
        grid-column: 2 / -1;
    }

    .ym-dashboard-table--stock tfoot tr {
        grid-template-columns: 1fr auto;
    }

    .ym-dashboard-table--stock tfoot th:nth-child(1) {
        grid-column: 1 / -1;
    }

    .ym-dashboard-table--stock tfoot th:nth-child(2) {
        grid-column: 1;
    }

    .ym-dashboard-table--stock tfoot th:nth-child(3) {
        grid-column: 2;
    }
}
