:root {
    --argus-table-page: #f7f8fa;
    --argus-table-surface: #ffffff;
    --argus-table-surface-muted: #f1f5f9;
    --argus-table-header: #334155;
    --argus-table-header-border: #263244;
    --argus-table-header-text: #ffffff;
    --argus-table-border: #d9e1ea;
    --argus-table-border-soft: #e8edf3;
    --argus-table-text: #172033;
    --argus-table-muted: #475569;
    --argus-table-accent: #1d4ed8;
    --argus-table-accent-hover: #1e40af;
    --argus-table-focus: #2563eb;
}

.argus-table-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 4px 0 20px;
}

.argus-table-page-header h1 {
    margin: 2px 0 4px;
    color: var(--argus-table-text);
    font-size: clamp(1.35rem, 2vw, 1.5rem);
    font-weight: 650;
    line-height: 1.25;
}

.argus-table-page-header p {
    margin: 0;
    color: var(--argus-table-muted);
    font-size: 0.875rem;
}

.argus-table-page-kicker {
    color: var(--argus-table-accent);
    font-size: 0.75rem;
    font-weight: 700;
}

.argus-table-page-count {
    flex: 0 0 auto;
    padding: 7px 11px;
    color: var(--argus-table-muted);
    background: var(--argus-table-surface-muted);
    border: 1px solid var(--argus-table-border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.argus-table-region,
.table-responsive:has(> .argus-data-table) {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background: var(--argus-table-surface);
    border: 1px solid var(--argus-table-border);
    border-radius: 8px;
    box-shadow: none;
    scrollbar-color: #aeb8c6 transparent;
    scrollbar-width: thin;
}

.argus-table-region:focus-visible {
    outline: 2px solid var(--argus-table-focus);
    outline-offset: 2px;
}

table.argus-data-table {
    width: 100%;
    min-width: 0;
    margin: 0;
    color: var(--argus-table-text);
    background: var(--argus-table-surface);
    border: 1px solid var(--argus-table-border);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    box-shadow: none;
    font-size: 0.875rem;
    line-height: 1.4;
    table-layout: fixed;
}

.argus-table-region > table.argus-data-table,
.table-responsive > table.argus-data-table {
    border: 0;
    border-radius: 0;
}

table.argus-data-table > thead > tr > th,
table.argus-data-table > tbody > tr > td,
table.argus-data-table > tfoot > tr > td {
    min-width: 0;
    max-width: none;
    padding: 11px 14px;
    overflow: visible;
    color: inherit;
    border: 0;
    border-bottom: 1px solid var(--argus-table-border-soft);
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: left;
    text-overflow: clip;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
}

table.argus-data-table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-block: 10px;
    color: var(--argus-table-header-text) !important;
    background: var(--argus-table-header) !important;
    border-bottom-color: var(--argus-table-header-border) !important;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

table.argus-data-table > tbody > tr {
    background: var(--argus-table-surface);
    transition: background-color 120ms ease;
}

table.argus-data-table > tbody > tr:nth-of-type(odd) {
    background: #fbfcfd;
}

table.argus-data-table > tbody > tr:hover,
table.argus-data-table > tbody > tr:focus-within {
    background: #f3f6fb;
}

table.argus-data-table > tbody > tr:last-child > td,
table.argus-data-table > tfoot > tr:last-child > td {
    border-bottom: 0;
}

table.argus-data-table .sortable {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    color: inherit;
    text-decoration: none;
}

table.argus-data-table a:not(.btn),
table.argus-data-table .btn-link,
table.argus-data-table .btn-table {
    color: var(--argus-table-accent) !important;
    font-size: inherit !important;
    font-weight: 650;
    text-decoration: none !important;
}

table.argus-data-table a:not(.btn):hover,
table.argus-data-table a:not(.btn):focus-visible,
table.argus-data-table .btn-link:hover,
table.argus-data-table .btn-link:focus-visible,
table.argus-data-table .btn-table:hover,
table.argus-data-table .btn-table:focus-visible {
    color: var(--argus-table-accent-hover) !important;
    text-decoration: underline !important;
}

table.argus-data-table > thead > tr > th,
table.argus-data-table > thead > tr > th *,
table.argus-data-table > thead > tr > th a:not(.btn),
table.argus-data-table > thead > tr > th button,
table.argus-data-table > thead > tr > th .sortable,
table.argus-data-table > thead > tr > th .btn-link,
table.argus-data-table > thead > tr > th .btn-table,
.unpaid-orders-table > thead > tr > th,
.unpaid-orders-table > thead > tr > th * {
    color: var(--argus-table-header-text) !important;
}

table.argus-data-table > thead > tr > th a:not(.btn):hover,
table.argus-data-table > thead > tr > th a:not(.btn):focus-visible,
table.argus-data-table > thead > tr > th .sortable:hover,
table.argus-data-table > thead > tr > th .sortable:focus-visible {
    color: var(--argus-table-header-text) !important;
}

table.argus-data-table a:focus-visible,
table.argus-data-table button:focus-visible,
table.argus-data-table .sortable:focus-visible {
    outline: 2px solid var(--argus-table-focus) !important;
    outline-offset: 2px;
    box-shadow: none !important;
}

table.argus-data-table .btn,
table.argus-data-table button {
    min-height: 36px;
}

table.argus-data-table td[data-label="Сумма"],
table.argus-data-table td[data-label="Осталось"],
table.argus-data-table td[data-label="Поступления"],
table.argus-data-table td[data-label="Расходы"],
table.argus-data-table td[data-label="Комиссии"],
table.argus-data-table td[data-label="Денежный результат"],
table.argus-data-table .dealer-list-table__money,
table.argus-data-table .receipt-history-amount,
table.argus-data-table .cash-history-amount,
table.argus-data-table .unassigned-receipt-amount {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

table.argus-data-table.finance-report__table > thead > tr > th:not(:first-child),
table.argus-data-table.finance-report__table > tbody > tr > td:not(:first-child),
table.argus-data-table.finance-report__table > tfoot > tr > td:not(:first-child) {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

table.argus-data-table .dealer-list-table__action {
    text-align: right;
}

table.argus-data-table .order-status-badge {
    padding: 4px 8px;
    color: var(--argus-table-text);
    background: color-mix(in srgb, var(--status-color) 28%, #fff);
    border: 1px solid color-mix(in srgb, var(--status-color) 62%, var(--argus-table-border));
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 650;
}

table.argus-data-table > tbody > tr.dealer-client-row {
    background: #f4fbf7;
    box-shadow: inset 3px 0 #4f9d70;
}

table.argus-data-table > tbody > tr.argus-data-table__row--muted {
    color: #5f6877;
    background: #f1f3f5;
    box-shadow: inset 3px 0 #7b8492;
}

table.argus-data-table > tbody > tr.argus-data-table__row--complete-material {
    background: #fffaf0;
    box-shadow: inset 3px 0 #bd8b2f;
}

table.argus-data-table .argus-data-table__empty-row,
table.argus-data-table .argus-data-table__empty-row:hover {
    background: var(--argus-table-surface);
}

table.argus-data-table .argus-data-table__empty-row > td {
    padding: 36px 16px;
    color: var(--argus-table-muted);
    text-align: center;
}

.short-table-page .new-clickable-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--argus-table-muted);
    font-size: 0.875rem;
    font-weight: 650;
    line-height: 1.35;
}

.short-table-page table.short-orders-table.argus-data-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.short-table-page table.short-orders-table.argus-data-table > thead > tr > th,
.short-table-page table.short-orders-table.argus-data-table > tbody > tr > td {
    min-width: 0;
    max-width: none;
    padding: 8px 9px;
    color: inherit;
    background: transparent;
    border-bottom: 1px solid var(--argus-table-border-soft);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.short-table-page table.short-orders-table.argus-data-table > thead > tr > th {
    color: var(--argus-table-header-text) !important;
    background: var(--argus-table-header) !important;
    border-bottom-color: var(--argus-table-header-border) !important;
    font-size: 0.75rem;
    text-transform: none;
}

.unpaid-orders-table {
    width: 100%;
    margin: 0;
    color: var(--argus-table-text);
    background: var(--argus-table-surface);
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.unpaid-orders-table th,
.unpaid-orders-table td {
    padding: 11px 14px;
    color: inherit;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--argus-table-border-soft);
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: left;
    vertical-align: middle;
}

.unpaid-orders-table th {
    color: var(--argus-table-header-text) !important;
    background: var(--argus-table-header) !important;
    border-bottom-color: var(--argus-table-header-border) !important;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.unpaid-orders-table tbody tr:nth-of-type(odd) {
    background: #fbfcfd;
}

.unpaid-orders-table tbody tr:hover {
    background: #f3f6fb;
}

.unpaid-orders-table a {
    color: var(--argus-table-accent);
    font-weight: 650;
    text-decoration: none;
}

.unpaid-orders-table a:hover,
.unpaid-orders-table a:focus-visible {
    color: var(--argus-table-accent-hover);
    text-decoration: underline;
}

.unpaid-orders-table .unpaid-orders-amount-heading,
.unpaid-orders-table .unpaid-orders-amount {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.client-search-page .client-search-table-shell.argus-table-region {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
}

.client-search-page table.client-search-results-table.argus-data-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

@media (max-width: 768px) {
    .argus-table-page-header {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 16px;
    }

    .argus-table-page-count {
        align-self: flex-start;
    }

    table.argus-data-table:not(.argus-data-table--cards) {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

    table.argus-data-table.argus-data-table--cards,
    table.argus-data-table.argus-data-table--cards > tbody {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    table.argus-data-table.argus-data-table--cards {
        border: 0;
        border-radius: 0;
    }

    table.argus-data-table.argus-data-table--cards > thead {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
        clip: rect(0 0 0 0) !important;
        clip-path: inset(50%) !important;
        white-space: nowrap !important;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr,
    table.argus-data-table.argus-data-table--cards > tbody > tr:nth-of-type(odd) {
        display: block !important;
        width: 100% !important;
        margin: 0 0 12px !important;
        padding: 8px 12px !important;
        overflow: hidden;
        background: var(--argus-table-surface) !important;
        border: 1px solid var(--argus-table-border) !important;
        border-radius: 8px !important;
        box-shadow: none !important;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr > td {
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 16px !important;
        padding: 8px 0 !important;
        color: var(--argus-table-text) !important;
        background: transparent !important;
        border: 0 !important;
        border-bottom: 1px solid var(--argus-table-border-soft) !important;
        font-size: 0.875rem !important;
        text-align: right !important;
        white-space: normal !important;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr > td:last-child {
        border-bottom: 0 !important;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr > td::before {
        content: attr(data-label) !important;
        max-width: 44%;
        flex: 0 0 44%;
        color: var(--argus-table-muted) !important;
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        text-align: left !important;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr.argus-data-table__empty-row {
        padding: 0 !important;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr.argus-data-table__empty-row > td {
        display: block !important;
        padding: 28px 16px !important;
        text-align: center !important;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr.argus-data-table__empty-row > td::before,
    table.argus-data-table.argus-data-table--cards > tbody > tr.stock-empty-row > td::before {
        display: none !important;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr.stock-batch-row {
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr.stock-batch-row > th {
        display: block;
        width: 100%;
        padding: 10px 12px;
        color: var(--argus-table-muted);
        background: var(--argus-table-surface-muted);
        border: 1px solid var(--argus-table-border);
        border-radius: 8px;
        font-size: 0.8125rem;
        text-align: left;
    }

    table.argus-data-table.argus-data-table--cards > tbody > tr > td[data-label="Подробности"],
    table.argus-data-table.argus-data-table--cards > tbody > tr > td[data-label="Действие"],
    table.argus-data-table.argus-data-table--cards > tbody > tr > td[data-label="Действия"] {
        align-items: center !important;
    }

    table.argus-data-table.argus-data-table--cards .btn,
    table.argus-data-table.argus-data-table--cards button {
        min-height: 44px;
    }

    .argus-table-region {
        overflow-x: hidden;
        background: transparent;
        border: 0;
        border-radius: 0;
    }

    .argus-table-region:has(> table.argus-data-table:not(.argus-data-table--cards)) {
        background: var(--argus-table-surface);
        border: 1px solid var(--argus-table-border);
        border-radius: 8px;
    }

    .client-search-page .client-search-table-shell.argus-table-region {
        width: 100%;
        max-width: 100%;
        margin-inline: 0;
    }

    .unpaid-orders-table,
    .unpaid-orders-table tbody {
        display: block;
        width: 100%;
    }

    .unpaid-orders-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .unpaid-orders-table tbody tr {
        display: block;
        margin-bottom: 12px;
        padding: 8px 12px;
        background: var(--argus-table-surface);
        border: 1px solid var(--argus-table-border);
        border-radius: 8px;
    }

    .unpaid-orders-table tbody td {
        display: flex;
        width: 100%;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
        padding: 8px 0;
        background: transparent;
        border-bottom: 1px solid var(--argus-table-border-soft);
        text-align: right;
    }

    .unpaid-orders-table tbody td::before {
        content: attr(data-label);
        max-width: 44%;
        flex: 0 0 44%;
        color: var(--argus-table-muted);
        font-size: 0.75rem;
        font-weight: 600;
        text-align: left;
    }

    .unpaid-orders-table tbody td:last-child {
        border-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    table.argus-data-table > tbody > tr {
        transition: none;
    }
}
