* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 24px;
    background: #f5f6f8;
    color: #222;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;
    line-height: 1.45;
}

main {
    max-width: 1900px;
    margin: 0 auto;
}

h1,
h2,
h3 {
    margin-top: 0;
}

.tabs {
    display: flex;
    gap: 8px;
    margin: 24px 0 0;
    border-bottom: 1px solid #dce0e5;
}

.tab-button {
    padding: 12px 22px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: #555;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.tab-button:hover {
    color: #111;
}

.tab-button.is-active {
    border-bottom-color: #246bfd;
    color: #246bfd;
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    margin-left: 0.4rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(36, 107, 253, 0.12);
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.2;
}

.tab-button.is-active .tab-count {
    background: rgba(36, 107, 253, 0.18);
    color: #246bfd;
}

.badge-kind {
    background: #eef2ff;
    color: #3730a3;
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
}

.summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
}

.summary-item {
    min-width: 170px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 10px;
}

.summary-item strong {
    display: block;
    margin-top: 3px;
    font-size: 24px;
}

.section {
    margin: 24px 0;
    padding: 20px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 12px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 1350px;
    border-collapse: collapse;
}

th,
td {
    padding: 10px;
    vertical-align: top;
    text-align: left;
    border: 1px solid #e1e4e8;
}

th {
    background: #eef1f5;
    white-space: nowrap;
}

tbody tr:nth-child(even) {
    background: #fafbfc;
}

.attributes {
    min-width: 220px;
    margin: 0;
}

.attributes div {
    margin-bottom: 7px;
}

.attributes dt {
    font-weight: 600;
}

.attributes dd {
    margin: 2px 0 0;
}

.tech-props {
    min-width: 260px;
    margin: 0;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
}

.tech-props__row {
    display: grid;
    grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
    gap: 0.35rem 0.75rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #edf0f3;
}

.tech-props__row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.tech-props__row:first-child {
    padding-top: 0;
}

.tech-props dt {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #475467;
}

.tech-props dd {
    margin: 0;
    font-size: 0.875rem;
    color: #101828;
    word-break: break-word;
}

.prices {
    min-width: 170px;
    margin: 0;
    padding-left: 18px;
}

.components {
    min-width: 680px;
}

.components table {
    min-width: 680px;
    font-size: 13px;
}

.muted {
    color: #777;
}

.nowrap {
    white-space: nowrap;
}

.error {
    padding: 16px;
    color: #a40000;
    background: #fff3f3;
    border: 1px solid #f0bcbc;
    border-radius: 8px;
}

.sync-control {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 12px;
}

.sync-control h2 {
    margin-bottom: 5px;
    font-size: 20px;
}

.sync-control p {
    margin: 0;
}

.sync-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.sync-secret {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
}

.sync-secret input {
    width: 250px;
    padding: 10px 12px;
    border: 1px solid #cbd0d7;
    border-radius: 7px;
    font: inherit;
}

.sync-button {
    padding: 11px 18px;
    border: 0;
    border-radius: 7px;
    background: #246bfd;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.sync-button:hover {
    background: #1857dc;
}

.sync-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.sync-result {
    margin: 15px 0 25px;
    padding: 18px;
    border-radius: 10px;
}

.sync-result h3 {
    margin: 0 0 15px;
}

.sync-result p {
    margin-bottom: 0;
}

.sync-result.is-loading {
    background: #f1f6ff;
    border: 1px solid #b8d0ff;
}

.sync-result.is-success {
    background: #effaf3;
    border: 1px solid #a9dbba;
}

.sync-result.is-error {
    color: #8f0000;
    background: #fff3f3;
    border: 1px solid #f0bcbc;
}

.sync-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sync-stats span {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.sync-log {
    max-height: 280px;
    margin: 15px 0 0;
    padding: 12px 12px 12px 35px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 7px;
    font-family: monospace;
    font-size: 13px;
}

.sync-time {
    color: #777;
}

@media (max-width: 800px) {
    .sync-control,
    .sync-form {
        align-items: stretch;
        flex-direction: column;
    }

    .sync-secret input {
        width: 100%;
    }
}

.sync-result.is-error p {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: monospace;
}

.structure-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 0 0 16px;
    font-size: 13px;
    color: #555;
}

.structure-tree {
    padding: 16px 18px;
    background: #f7f9fc;
    border: 1px solid #d9e2ef;
    border-radius: 10px;
}

.structure-tree ul {
    margin: 8px 0 0;
    padding-left: 22px;
    list-style: none;
}

.structure-tree li {
    margin: 8px 0;
}

.structure-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.structure-code {
    padding: 1px 6px;
    border-radius: 4px;
    background: #e8eef7;
    color: #445;
    font-size: 12px;
}

.structure-components {
    margin: 6px 0 0 !important;
    padding-left: 18px !important;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-hidden {
    color: #6b5b00;
    background: #fff3bf;
}

.badge-category {
    color: #0b4f8a;
    background: #d6ebff;
}

.badge-product {
    color: #1f6b3a;
    background: #d9f5e3;
}

.badge-group {
    color: #6b2f9b;
    background: #efddff;
}

.badge-unified {
    color: #0d5c63;
    background: #c9f3f5;
}

.badge-variation {
    color: #7a3e00;
    background: #ffe3c2;
}

.badge-kit {
    color: #8a1c3c;
    background: #ffd6e2;
}

.badge-component {
    color: #334;
    background: #e4e8ef;
}

.badge-skip-export {
    color: #7f1d1d;
    background: #fee2e2;
}

.badge-export-ok {
    color: #14532d;
    background: #dcfce7;
}

.export-flag {
    min-width: 9rem;
}

.export-flag__value {
    margin-top: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #101828;
    word-break: break-word;
}

.export-flag__meta {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: #667085;
}

.export-flag--empty .export-flag__meta {
    margin-top: 0.35rem;
}

.unified-product {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #d5e0ef;
    border-radius: 10px;
    box-shadow: 0 1px 0 rgba(15, 30, 60, 0.04);
}

.unified-product.is-kit {
    border-color: #9ad8dc;
    background: linear-gradient(180deg, #f3fcfd 0%, #ffffff 48%);
}

.unified-product-head {
    gap: 10px;
}

.unified-meta {
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8eef7;
    color: #445;
    font-size: 12px;
}

.unified-hint {
    margin: 8px 0 0;
    font-size: 13px;
}

.unified-variations {
    margin-top: 10px !important;
}

.unified-variation {
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e6edf7;
    border-radius: 8px;
}
