.csr-tool-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-left: 6px;
    padding: 0;
    border: 1px solid #6ca53a;
    border-radius: 4px;
    background-color: #6ca53a;
    color: #fff;
    vertical-align: middle;
}

.csr-tool-btn:hover,
.csr-tool-btn:focus {
    background-color: #5f9533;
    border-color: #5f9533;
    color: #fff;
    outline: none;
}

.csr-tool-btn-icon {
    position: relative;
    display: inline-block;
    width: 13px;
    height: 13px;
}

.csr-tool-btn-icon::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 8px;
    height: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
}

.csr-tool-btn-icon::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 1px;
    width: 6px;
    height: 2px;
    background: #fff;
    transform: rotate(45deg);
    transform-origin: right center;
}

.csr-tool-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

body.csr-modal-open {
    overflow: hidden;
}

.csr-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 22, 31, 0.62);
    backdrop-filter: blur(2px);
    padding: 90px 14px 24px;
}

.csr-modal-content {
    position: relative;
    margin: auto;
    width: min(1450px, 100%);
    border-radius: 10px;
    overflow: hidden;
    background-color: #eef2f5;
    border: 1px solid #3a434d;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.32);
    animation: csrModalSlideIn 0.25s ease-out;
}

.csr-modal-header {
    padding: 10px 16px;
    background: linear-gradient(90deg, #252b31 0%, #2d343c 100%);
    color: #ffcc0a;
    border-bottom: 1px solid #3a434d;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.csr-modal-header-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.csr-modal-header h3 {
    margin: 0;
    line-height: 1.2;
    font-size: clamp(21px, 1.7vw, 30px);
    font-weight: 700;
    color: #ffcc0a;
}

.csr-modal-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.csr-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid #45505c;
    background: rgba(10, 15, 21, 0.28);
    min-height: 30px;
}

.csr-meta-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #b8c2cc;
}

.csr-meta-value {
    font-size: 14px;
    font-weight: 700;
    color: #ffcc0a;
}

.csr-meta-link {
    display: inline-flex;
    align-items: center;
    color: #66b2ff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.csr-meta-link:hover,
.csr-meta-link:focus {
    color: #a7d4ff;
    text-decoration: underline;
}

.csr-meta-link[data-no-link] {
    color: inherit;
    cursor: default;
    pointer-events: none;
}

.csr-close-button {
    color: #b6bec8;
    border: 1px solid transparent;
    background: transparent;
    font-size: 22px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    line-height: 1;
}

.csr-close-button:hover,
.csr-close-button:focus {
    color: #fff;
    cursor: pointer;
    background-color: rgba(255, 204, 10, 0.14);
    border-color: rgba(255, 204, 10, 0.45);
    outline: none;
}

.csr-modal-body {
    padding: 14px 16px 16px;
    min-height: 220px;
    background: #e8edf2;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.csr-modal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.csr-modal-toolbar-title,
.csr-section-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #4f5d6b;
}

.csr-loading,
.csr-error,
.csr-empty {
    border-radius: 9px;
    padding: 14px 16px;
    font-size: 14px;
}

.csr-loading {
    background: #f3f6f8;
    border: 1px solid #d8dde3;
    color: #4f5d6b;
}

.csr-error {
    background: #fde2e2;
    border: 1px solid #efb4b4;
    color: #8b2e2e;
}

.csr-empty {
    background: #f2f5f8;
    border: 1px dashed #c9d2dc;
    color: #68717a;
    text-align: center;
}

.csr-retry-button {
    margin-top: 10px;
    border: 1px solid #b52a2a;
    background: #fff;
    color: #b52a2a;
    padding: 4px 10px;
    border-radius: 6px;
}

.csr-retry-button:hover,
.csr-retry-button:focus {
    background: #b52a2a;
    color: #fff;
}

.csr-table-wrap {
    overflow-x: auto;
    border: 1px solid #d8dde3;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(16, 24, 32, 0.05);
}

.csr-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.csr-table thead th {
    padding: 9px 12px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-bottom: 1px solid #3a434d;
    border-right: 1px solid #444d57;
    background: linear-gradient(90deg, #252b31 0%, #2d343c 100%);
    color: #ffcc0a;
    white-space: nowrap;
}

.csr-table thead th:last-child {
    border-right: 0;
}

.csr-table tbody td {
    padding: 8px 12px;
    color: #2a333c;
    border-bottom: 1px solid #e2e8ee;
    border-right: 1px solid #e2e8ee;
    vertical-align: middle;
    white-space: nowrap;
}

.csr-table tbody td:last-child {
    border-right: 0;
}

.csr-table tbody tr:last-child td {
    border-bottom: 0;
}

.csr-table tbody tr:nth-child(even) {
    background-color: #f2f5f8;
}

.csr-table tbody tr[data-has-tint="true"] {
    background-color: var(--csr-row-bg);
}

.csr-table tbody tr:hover {
    background-color: #e7edf3;
}

.csr-table tbody tr[data-has-tint="true"]:hover {
    background-color: var(--csr-row-hover);
}

.csr-best-cad,
.csr-best-usd {
    position: relative;
    font-weight: 700;
    color: #1f3d1e;
}

.csr-best-cad::after,
.csr-best-usd::after {
    content: "Best";
    margin-left: 8px;
    display: inline-block;
    font-size: 10px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #1f6a22;
    background: #dff5e3;
    border: 1px solid #b8e6bf;
    border-radius: 999px;
    padding: 2px 6px;
}

.csr-toggle-col {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
}

.csr-table .csr-toggle-cell {
    text-align: center;
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    padding: 4px;
}

.csr-tree-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #b0bec5;
    border-radius: 4px;
    background: #f5f7fa;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.csr-tree-toggle-btn:hover {
    background: #e3eaf1;
    border-color: #7c8fa0;
}

.csr-tree-toggle-btn:focus {
    background: #e3eaf1;
    border-color: #7c8fa0;
    outline: 2px solid #1f6a22;
    outline-offset: 2px;
}

.csr-toggle-icon {
    display: block;
    width: 10px;
    height: 10px;
    position: relative;
}

.csr-toggle-icon::before,
.csr-toggle-icon::after {
    content: "";
    position: absolute;
    background: #4f5d6b;
}

.csr-toggle-icon::before {
    top: 4px;
    left: 1px;
    width: 8px;
    height: 2px;
}

.csr-toggle-icon::after {
    top: 1px;
    left: 4px;
    width: 2px;
    height: 8px;
    transition: transform 0.15s ease;
}

.csr-tree-toggle-btn[aria-expanded="true"] .csr-toggle-icon::after {
    transform: scaleY(0);
}

.csr-row-hidden {
    display: none;
}

.csr-table tbody tr.csr-child-row,
.csr-distributor-table tbody tr.csr-child-row {
    background-color: #f7f9fb;
}

.csr-table tbody tr.csr-child-row:hover,
.csr-distributor-table tbody tr.csr-child-row:hover {
    background-color: #edf1f5;
}

.csr-distributor-table .csr-tree-depth-1 {
    padding-left: 28px;
    border-left: 2px solid #c5cdd6;
}

.csr-distributor-table .csr-tree-depth-2 {
    padding-left: 48px;
    border-left: 2px solid #d8dde3;
}

.csr-distributor-table .csr-tree-depth-3 {
    padding-left: 68px;
    border-left: 2px solid #e2e8ee;
}

.csr-region-pill {
    display: inline-block;
    font-weight: 600;
}

.csr-status {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.csr-status-available {
    background-color: #dff5e3;
    color: #1a7a2e;
}

.csr-status-low {
    background-color: #fff4d6;
    color: #8a6d00;
}

.csr-status-out {
    background-color: #fde2e2;
    color: #b52a2a;
}

.csr-status-unavailable {
    background-color: #e8eaed;
    color: #5f6b7a;
}

.csr-status-discontinued {
    background-color: #e8eaed;
    color: #5f6b7a;
    text-decoration: line-through;
}

.csr-modal-footer {
    padding: 10px 16px;
    background: linear-gradient(90deg, #252b31 0%, #2d343c 100%);
    color: #ffcc0a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #3a434d;
    gap: 10px;
}

.csr-modal-footer h3 {
    margin: 0;
    font-size: 16pt;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #ffcc0a;
}

.csr-footer-close {
    border: 1px solid rgba(255, 204, 10, 0.35);
    background: transparent;
    color: #dde3ea;
    border-radius: 8px;
    height: 34px;
    padding: 0 12px;
}

.csr-footer-close:hover,
.csr-footer-close:focus {
    background: rgba(255, 204, 10, 0.14);
    color: #fff;
    border-color: rgba(255, 204, 10, 0.55);
}

@keyframes csrModalSlideIn {
    from {
        top: -280px;
        opacity: 0;
    }

    to {
        top: 0;
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .csr-modal {
        padding-top: 30px;
    }

    .csr-modal-content {
        width: 100%;
    }

    .csr-modal-header {
        flex-direction: column;
    }

    .csr-close-button {
        align-self: flex-end;
    }

    .csr-modal-footer h3 {
        font-size: 13pt;
    }
}
