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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    font-size: 15px;
}

.header {
    background: #16213e;
    padding: 8px 16px;
    border-bottom: 1px solid #0f3460;
}

.logo-container {
    display: flex;
    align-items: center;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.025em;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.logo-prefix {
    color: #ffffff;
}

.logo-suffix {
    background: linear-gradient(to right, #60a5fa, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.header .subtitle {
    font-size: 15px;
    color: #888;
    margin-top: 2px;
}

.mode-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 8px 0;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

.mode-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-tab:hover {
    color: #e0e0e0;
}

.mode-tab.active {
    color: #38bdf8;
    border-bottom-color: #38bdf8;
}

.mode-content {
    display: none;
}

.mode-content.active {
    display: block;
}

.main-layout {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 16px;
    padding: 8px;
    min-height: calc(100vh - 120px);
}

.panel {
    background: #16213e;
    border-radius: 12px;
    padding: 8px;
    border: 1px solid #0f3460;
}

.panel h2 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #ffffff;
    border-bottom: 1px solid #0f3460;
    padding-bottom: 6px;
}

.category-group {
    margin-bottom: 8px;
}

.category-group h3 {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-group h3:hover {
    color: #38bdf8;
}

.component-select {
    width: 100%;
    padding: 7px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
}

.component-select:focus {
    outline: none;
    border-color: #38bdf8;
}

.component-card {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 8px;
    margin-top: 4px;
    font-size: 13px;
    display: none;
}

.component-card.visible {
    display: block;
}

.component-card .spec-row {
    display: flex;
    justify-content: space-between;
    padding: 1px 0;
}

.component-card .spec-label {
    color: #888;
}

.component-card .spec-value {
    color: #e0e0e0;
}

#build-visual {
    min-height: 180px;
    background: #1a1a2e;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
}

.build-slot {
    background: #0f3460;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    min-width: 110px;
}

.build-slot .slot-label {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
}

.build-slot .slot-value {
    color: #e0e0e0;
    margin-top: 2px;
}

.build-slot .slot-value.empty {
    color: #555;
    font-style: italic;
}

.build-actions {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: #38bdf8;
    color: #0f172a;
    font-weight: 600;
}

.btn-primary:hover {
    background: #0ea5e9;
}

.btn-secondary {
    background: #0f3460;
    color: #e0e0e0;
}

.btn-secondary:hover {
    background: #1a4a7a;
}

.diagnostic-item {
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 14px;
    border-left: 4px solid;
}

.diagnostic-item.error {
    background: rgba(244, 63, 94, 0.1);
    border-color: #f43f5e;
}

.diagnostic-item.warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

.diagnostic-item.info {
    background: rgba(0, 150, 255, 0.1);
    border-color: #0096ff;
}

.diagnostic-item.success {
    background: rgba(76, 175, 80, 0.1);
    border-color: #4caf50;
}

.diagnostic-item .diag-title {
    font-weight: 600;
    margin-bottom: 3px;
}

.diagnostic-item .diag-message {
    color: #aaa;
    font-size: 13px;
}

#build-stats {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #0f3460;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 14px;
}

.stat-row .stat-label {
    color: #888;
}

.stat-row .stat-value {
    color: #e0e0e0;
    font-weight: 600;
}

.panel-saved {
    margin: 0 8px 8px;
}

.saved-build-item {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.saved-build-item .build-name {
    font-weight: 600;
    font-size: 15px;
}

.saved-build-item .build-date {
    color: #888;
    font-size: 13px;
}

.saved-build-actions {
    display: flex;
    gap: 6px;
}

.saved-build-actions button {
    padding: 4px 10px;
    font-size: 13px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-load {
    background: #0f3460;
    color: #e0e0e0;
}

.btn-delete {
    background: #f43f5e;
    color: white;
}

/* Analyzer */
.optimizer-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.optimizer-form label {
    font-size: 14px;
    color: #aaa;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.optimizer-form select,
.optimizer-form input {
    padding: 7px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
}

.optimizer-form select:focus,
.optimizer-form input:focus {
    outline: none;
    border-color: #38bdf8;
}

.opt-result {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    border: 1px solid #0f3460;
    transition: border-color 0.2s;
}

.opt-result:hover {
    border-color: #38bdf8;
}

.opt-result.selected {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.05);
}

.opt-result .opt-rank {
    font-size: 18px;
    font-weight: 700;
    color: #38bdf8;
    margin-right: 8px;
}

.opt-result .opt-score {
    font-size: 14px;
    color: #4caf50;
    font-weight: 600;
}

.opt-result .opt-name {
    font-size: 15px;
    font-weight: 600;
}

.opt-result .opt-meta {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

.opt-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 13px;
    border-bottom: 1px solid #0f3460;
}

.opt-detail-row:last-child {
    border-bottom: none;
}

.opt-detail-label {
    color: #888;
}

.opt-detail-value {
    color: #e0e0e0;
}

.subsystem-block {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
}

.subsystem-block h4 {
    font-size: 14px;
    color: #e0e0e0;
    margin-bottom: 6px;
}

.subsystem-ok {
    color: #4caf50;
    font-size: 13px;
}

.subsystem-issue {
    color: #f43f5e;
    font-size: 13px;
}

@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

/* Wizard */
.wizard-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 100px);
}

.wizard-progress {
    background: #16213e;
    padding: 8px;
    border-bottom: 1px solid #0f3460;
}

.wizard-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.wizard-step-btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 6px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    white-space: nowrap;
}

.wizard-step-btn:hover {
    border-color: #38bdf8;
    color: #e0e0e0;
}

.wizard-step-btn.active {
    background: #38bdf8;
    border-color: #38bdf8;
    color: #0f172a;
    font-weight: 600;
}

.wizard-step-btn.completed {
    background: rgba(76, 175, 80, 0.15);
    border-color: #4caf50;
    color: #4caf50;
}

.wizard-body {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    padding: 8px;
    flex: 1;
}

.wizard-step-content {
    background: #16213e;
    border-radius: 12px;
    padding: 8px;
    border: 1px solid #0f3460;
}

.wizard-header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #0f3460;
}

.wizard-step-header h2 {
    font-size: 22px;
    color: #ffffff;
    margin-bottom: 6px;
}

.wizard-step-desc {
    color: #888;
    font-size: 14px;
    margin-bottom: 12px;
}

#wizard-step-body {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.wizard-option {
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
}

.wizard-option:hover {
    border-color: #38bdf8;
}

.wizard-option.selected {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
}

.wizard-option .opt-main {
    flex: 1;
}

.wizard-option .opt-name {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
}

.wizard-option .opt-specs {
    font-size: 13px;
    color: #888;
    margin-top: 3px;
}

.wizard-option .opt-price {
    font-size: 16px;
    color: #4caf50;
    font-weight: 600;
    margin-top: 6px;
    white-space: nowrap;
}

.wizard-option .opt-detail {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #0f3460;
    display: none;
}

.wizard-option.selected .opt-detail {
    display: block;
}

.full-specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.full-specs-table tr {
    border-bottom: 1px solid #0f3460;
}

.full-specs-table tr:last-child {
    border-bottom: none;
}

.full-specs-table .fs-label {
    color: #888;
    padding: 3px 8px 3px 0;
    white-space: nowrap;
    width: 45%;
    vertical-align: top;
}

.full-specs-table .fs-value {
    color: #e0e0e0;
    padding: 3px 0;
}

.search-links {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #0f3460;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.search-link {
    display: inline-block;
    padding: 3px 10px;
    background: #0f3460;
    border: 1px solid #1a4a7a;
    border-radius: 4px;
    color: #88aaff;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.2s;
}

.search-link:hover {
    background: #1a4a7a;
    color: #e0e0e0;
}

.wizard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wizard-sidebar .panel {
    flex: 1;
}

.wizard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #16213e;
    border-top: 1px solid #0f3460;
}

#wizard-step-indicator {
    font-size: 14px;
    color: #888;
}

.wizard-count-select {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.wizard-count-btn {
    padding: 8px 16px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-count-btn:hover {
    border-color: #38bdf8;
}

.wizard-count-btn.selected {
    background: #38bdf8;
    border-color: #38bdf8;
    color: #0f172a;
    font-weight: 600;
}

.wizard-multi-select {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 12px;
}

.wizard-multi-btn {
    padding: 8px 14px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-multi-btn:hover {
    border-color: #38bdf8;
}

.wizard-multi-btn.selected {
    background: rgba(56, 189, 248, 0.15);
    border-color: #38bdf8;
    color: #38bdf8;
}

.wizard-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.wizard-summary-item {
    background: #1a1a2e;
    border-radius: 6px;
    padding: 8px;
}

.wizard-summary-item .ws-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
}

.wizard-summary-item .ws-value {
    font-size: 14px;
    color: #e0e0e0;
    margin-top: 2px;
}

.wizard-summary-item .ws-value.empty {
    color: #555;
    font-style: italic;
}

.wizard-summary-item .ws-search {
    margin-top: 4px;
}

.wizard-summary-item .ws-search .search-link {
    font-size: 9px;
    padding: 2px 6px;
}

.summary-search-all {
    margin-top: 12px;
}

@media (max-width: 1400px) {
    #wizard-step-body {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1100px) {
    #wizard-step-body {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .wizard-body {
        grid-template-columns: 1fr;
    }
    #wizard-step-body {
        grid-template-columns: 1fr;
    }
}

.opt-img {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    background: #0f3460;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.opt-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

