:root {
    --bg: #f2f3f5;
    --surface: #ffffff;
    --surface-soft: #f8f9fb;
    --text: #1f2328;
    --muted: #6b7280;
    --line: #dfe3e8;
    --dark: #202a36;
    --dark-2: #2b3645;
    --orange: #ff7a00;
    --orange-dark: #e46100;
    --blue: #246bcb;
    --green: #15803d;
    --green-soft: #eefaf1;
    --red: #b42318;
    --red-soft: #fff1f0;
    --shadow: 0 10px 24px rgba(31, 35, 40, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: Arial, sans-serif;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
}

.container {
    width: min(1360px, calc(100% - 32px));
    margin: 0 auto;
}

.store-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.header-main {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 18px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 10px;
    color: #fff;
    background: var(--orange);
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: var(--muted);
}

.header-actions,
.nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.header-actions a {
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
}

#user-label {
    color: var(--muted);
    font-size: 13px;
}

main {
    padding: 24px 0 44px;
}

.configurator-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}

.configurator-title h1 {
    font-size: 30px;
}

.configurator-title p {
    color: var(--muted);
    margin-top: 4px;
}

.admin-title {
    align-items: center;
}

.admin-title .eyebrow {
    margin-bottom: 2px;
}

.admin-section-nav {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}

.admin-section-nav a {
    padding: 10px 12px;
    border-radius: 8px;
    color: #374151;
    background: var(--surface-soft);
    text-decoration: none;
    font-weight: 800;
}

.admin-section-nav a:hover {
    color: #fff;
    background: var(--orange);
}

.counter-pill {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 8px;
    color: #fff;
    background: var(--dark-2);
    font-weight: 700;
}

.recommended-section {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
}

.recommended-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 14px;
}

.recommended-head h2 {
    font-size: 24px;
}

.recommended-head > span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

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

.recommended-card {
    display: grid;
    gap: 10px;
    min-height: 190px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.recommended-card strong {
    display: block;
    color: var(--text);
    font-size: 17px;
}

.recommended-card p,
.recommended-card small {
    color: var(--muted);
}

.recommended-card p {
    margin-top: 6px;
    font-size: 14px;
}

.recommended-card > span {
    color: var(--orange-dark);
    font-size: 20px;
    font-weight: 800;
}

.builder-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr) 360px;
    gap: 16px;
    align-items: start;
}

.step-nav,
.parts-panel,
.summary-card,
.admin-layout section,
.auth-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.step-nav {
    position: sticky;
    top: 14px;
    overflow: hidden;
}

.step-link {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    padding: 14px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

.step-link:last-child {
    border-bottom: 0;
}

.step-link span {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #fff;
    background: #9aa4b2;
    font-weight: 700;
}

.step-link strong,
.step-link small {
    display: block;
}

.step-link small {
    color: var(--muted);
    margin-top: 2px;
}

.step-link.done span {
    background: var(--orange);
}

.step-link.done small {
    color: var(--orange-dark);
    font-weight: 700;
}

.parts-panel {
    overflow: hidden;
}

.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

h2 {
    font-size: 21px;
    line-height: 1.25;
}

.status-message {
    margin-top: 6px;
    color: var(--muted);
}

.error-message {
    color: var(--red);
}

.part-list {
    display: grid;
}

.part-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.part-card:last-child {
    border-bottom: 0;
}

.part-card-index {
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--dark-2);
    font-size: 20px;
    font-weight: 800;
}

.part-card-body {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(260px, 1.1fr);
    gap: 18px;
    padding: 18px;
    align-items: center;
}

.part-card-head {
    display: grid;
    gap: 7px;
}

.part-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.part-title span {
    padding: 4px 7px;
    border-radius: 6px;
    color: #fff;
    background: var(--orange);
    font-size: 12px;
    font-weight: 800;
}

.part-title h3 {
    font-size: 19px;
}

.part-card p,
.component-choice,
.selected-line small,
.history-item span,
.admin-item span {
    color: var(--muted);
    font-size: 14px;
}

.component-choice {
    grid-column: 1 / -1;
    padding: 11px 13px;
    border: 1px dashed #cfd6df;
    border-radius: 8px;
    background: var(--surface-soft);
}

.component-choice.selected {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 14px;
    align-items: center;
    border-style: solid;
    border-color: #ffd0a3;
    background: #fff8f1;
}

.component-choice.selected.has-photo {
    grid-template-columns: 86px minmax(0, 1fr) auto;
}

.component-choice strong,
.component-choice span {
    display: block;
}

.component-choice.selected.has-photo strong,
.component-choice.selected.has-photo span {
    grid-column: 2;
}

.component-choice b {
    grid-row: 1 / span 2;
    grid-column: 2;
    align-self: center;
    color: var(--orange-dark);
    font-size: 18px;
}

.component-choice.selected.has-photo b {
    grid-column: 3;
}

.component-photo {
    grid-row: 1 / span 2;
    grid-column: 1;
    width: 86px;
    height: 64px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

select,
input,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cfd6df;
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

select:focus,
input:focus,
textarea:focus {
    border-color: var(--orange);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(255, 122, 0, 0.16);
}

.filter-hint {
    min-height: 20px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
}

.filter-hint.bad {
    color: var(--red);
    font-weight: 700;
}

.summary-panel {
    position: sticky;
    top: 14px;
    display: grid;
    gap: 14px;
}

.summary-card {
    padding: 18px;
}

.summary-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.summary-head span {
    padding: 5px 8px;
    border-radius: 6px;
    color: var(--green);
    background: var(--green-soft);
    font-size: 12px;
    font-weight: 700;
}

.selected-components {
    display: grid;
    gap: 8px;
    margin: 14px 0;
}

.selected-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 3px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.selected-line span,
.selected-line strong,
.selected-line small {
    grid-column: 2;
}

.muted-line {
    grid-template-columns: 1fr;
}

.muted-line span,
.muted-line strong {
    grid-column: auto;
}

.summary-photo {
    grid-row: 1 / span 3;
    width: 52px;
    height: 44px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.selected-line span {
    color: var(--muted);
    font-size: 13px;
}

.selected-line strong {
    font-size: 15px;
}

.muted-line strong {
    color: #9aa4b2;
    font-weight: 400;
}

.total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #fff3e6;
}

.total-price span {
    color: #8a3d00;
}

.total-price strong {
    color: var(--orange-dark);
    font-size: 24px;
}

.build-name-field {
    display: grid;
    gap: 7px;
    margin-bottom: 12px;
    color: #374151;
    font-weight: 700;
}

.compatibility-status {
    display: grid;
    gap: 4px;
    padding: 12px;
    margin: 14px 0;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.compatibility-status.ok {
    color: var(--green);
    border-color: #bbf7d0;
    background: var(--green-soft);
}

.compatibility-status.bad {
    color: var(--red);
    border-color: #fecaca;
    background: var(--red-soft);
}

.compatibility-status span {
    font-size: 14px;
}

.build-btn,
.reset-btn,
.small-btn,
.tab-btn {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.build-btn {
    width: 100%;
    min-height: 46px;
    color: #fff;
    background: var(--orange);
}

.build-btn:hover,
.small-btn:hover {
    background: var(--orange-dark);
}

.build-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.reset-btn {
    min-height: 40px;
    padding: 0 13px;
    color: #374151;
    background: #eef1f5;
}

.small-btn {
    padding: 9px 13px;
    color: #fff;
    background: var(--orange);
}

.secondary-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 700;
}

.history-list,
.admin-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.history-item,
.admin-item {
    display: grid;
    gap: 4px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.history-item strong {
    color: var(--orange-dark);
}

.admin-category {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.admin-category summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    color: var(--text);
    background: var(--surface-soft);
    font-weight: 800;
}

.admin-category summary small {
    min-width: 28px;
    padding: 4px 7px;
    border-radius: 999px;
    color: var(--orange-dark);
    background: #fff3e6;
    text-align: center;
}

.admin-category-list {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.history-item a {
    justify-self: start;
}

.build-result-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}

.build-result-hero h1 {
    font-size: 32px;
}

.build-result-hero p:not(.eyebrow) {
    color: var(--muted);
    margin-top: 4px;
}

.result-total {
    min-width: 220px;
    padding: 16px;
    border: 1px solid #ffd0a1;
    border-radius: 8px;
    background: #fff3e6;
}

.result-total span,
.result-total strong {
    display: block;
}

.result-total span {
    color: #8a3d00;
    font-weight: 700;
}

.result-total strong {
    color: var(--orange-dark);
    font-size: 28px;
}

.result-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.result-panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.result-components {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.result-component {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.result-component span,
.result-component small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.result-component strong {
    display: block;
    margin: 2px 0;
}

.result-component b {
    color: var(--orange-dark);
}

.result-thumb {
    width: 72px;
    height: 58px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.result-thumb.placeholder {
    background: #eef1f5;
}

.result-side {
    position: sticky;
    top: 14px;
}

.result-action {
    display: grid;
    place-items: center;
    margin-top: 14px;
    text-decoration: none;
}

.rename-build-form {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.rename-build-form label {
    display: grid;
    gap: 7px;
    color: #374151;
    font-weight: 700;
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.75fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.recommended-admin-section {
    grid-column: 1 / -1;
}

.recommended-admin-item {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto auto;
    gap: 18px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.recommended-admin-main {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.recommended-admin-main strong {
    color: var(--text);
    font-size: 18px;
    line-height: 1.25;
}

.recommended-admin-main p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.recommended-admin-kicker {
    color: var(--muted);
    font-size: 13px;
}

.recommended-admin-meta,
.recommended-admin-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.recommended-admin-meta span {
    padding: 6px 9px;
    border-radius: 999px;
    color: #374151;
    background: #eef1f5;
    font-size: 13px;
    font-weight: 700;
}

.admin-layout section,
.auth-panel {
    padding: 24px;
}

.admin-form label,
.auth-form label {
    display: grid;
    gap: 7px;
    margin-bottom: 16px;
    color: #374151;
    font-weight: 700;
}

.image-picker {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    color: #374151;
    font-weight: 700;
}

.image-picker-row {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    min-height: 96px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.image-preview-frame {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.image-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-preview-frame span {
    padding: 0 8px;
    color: #9aa4b2;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.image-picker-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.image-picker-controls .reset-btn {
    min-height: 36px;
    padding: 0 12px;
}

.image-picker-controls small {
    flex-basis: 100%;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-clear-btn {
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.spec-editor {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.spec-editor-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.spec-editor-title strong {
    color: var(--text);
}

.spec-editor-title span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.spec-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-form .spec-field {
    display: grid;
    gap: 7px;
    margin: 0;
    color: #374151;
    font-weight: 700;
}

.spec-field > span {
    color: #374151;
    font-size: 13px;
}

.spec-choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-form .spec-choice,
.admin-form .spec-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 14px;
    font-weight: 700;
}

.spec-choice input,
.spec-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--orange);
}

.admin-item {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
}

.admin-thumb {
    width: 58px;
    height: 48px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.admin-thumb.placeholder {
    background: #eef1f5;
}

.auth-page {
    background: linear-gradient(135deg, #f7f8fa 0%, #fff 46%, #fff2e4 100%);
}

.auth-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(460px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-panel h1 {
    color: var(--dark);
    font-size: 34px;
}

.auth-panel p {
    color: var(--muted);
    margin-top: 8px;
}

.eyebrow {
    color: var(--orange);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 4px;
    margin: 22px 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.tab-btn {
    padding: 10px;
    color: #4b5563;
    background: transparent;
}

.tab-btn.active {
    color: #fff;
    background: var(--orange);
}

@media (max-width: 1180px) {
    .header-main,
    .builder-layout,
    .recommended-grid {
        grid-template-columns: 1fr;
    }

    .step-nav,
    .summary-panel {
        position: static;
    }

    .step-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .step-link {
        border-right: 1px solid var(--line);
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 20px, 1360px);
    }

    .configurator-title,
    .panel-toolbar,
    .recommended-head {
        display: grid;
    }

    .admin-section-nav {
        position: static;
        display: grid;
    }

    .configurator-title .counter-pill {
        justify-self: start;
    }

    .part-card-body,
    .admin-layout,
    .build-result-hero,
    .result-layout {
        grid-template-columns: 1fr;
    }

    .component-choice.selected.has-photo,
    .admin-item,
    .result-component {
        grid-template-columns: 1fr;
    }

    .recommended-admin-item {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .recommended-admin-meta,
    .recommended-admin-actions {
        flex-wrap: wrap;
        white-space: normal;
    }

    .recommended-admin-actions {
        justify-content: flex-start;
    }

    .image-picker-row {
        grid-template-columns: 1fr;
    }

    .result-side {
        position: static;
    }

    .spec-editor-title,
    .spec-fields {
        grid-template-columns: 1fr;
    }

    .spec-editor-title {
        display: grid;
    }

    .component-choice.selected.has-photo strong,
    .component-choice.selected.has-photo span,
    .component-choice.selected.has-photo b {
        grid-column: auto;
    }

    .step-nav {
        grid-template-columns: 1fr;
    }

    .part-card {
        grid-template-columns: 44px minmax(0, 1fr);
    }
}
