#result {
    display: none;
    margin-top: 26px;
}

#result.visible {
    display: block;
}

.result-head {
    margin-bottom: 18px;
}

.result-head-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
}

.result-head h2 {
    margin: 0 0 8px;
}

.result-summary {
    max-width: 900px;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.analysis-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 15px;
}

.analysis-chip {
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255,255,255,.025);
    font-size: 11px;
    color: #c7cedb;
}

.analysis-chip small {
    margin-left: 5px;
    color: #626d80;
}

.clarification-panel {
    padding: 22px;
}

.clarification-intro {
    max-width: 820px;
    color: var(--muted);
    line-height: 1.6;
}

.clarification-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.clarification-item {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(7,9,14,.58);
}

.clarification-number {
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.clarification-question {
    margin-bottom: 11px;
    font-weight: 650;
    line-height: 1.45;
}

.clarification-answer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
}

.clarification-answer {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid rgba(255,255,255,.10);
    outline: 0;
    border-radius: 10px;
    background: #090c12;
    color: var(--text);
}

.clarification-answer:focus {
    border-color: rgba(255,173,13,.5);
}

.auto-answer {
    white-space: nowrap;
}

.auto-answer.active {
    border-color: rgba(255,173,13,.45);
    color: var(--accent-2);
    background: rgba(255,173,13,.08);
}

.panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 18px;
}

.architecture-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 18px;
}

.graph-card {
    min-width: 0;
    overflow: hidden;
}

.graph-toolbar {
    min-height: 58px;
    padding: 10px 13px;
    display: flex;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.graph-toolbar-title {
    margin-right: auto;
    padding-left: 4px;
}

.graph-toolbar-title strong {
    display: block;
    font-size: 14px;
}

.graph-toolbar-title span {
    color: var(--muted);
    font-size: 11px;
}

.tool-button {
    min-width: 38px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255,255,255,.025);
    color: #cfd5df;
    cursor: pointer;
}

.tool-button:hover {
    border-color: rgba(255,173,13,.28);
    color: var(--accent-2);
}

.design-viewport {
    position: relative;
    height: 640px;
    overflow: hidden;
    cursor: grab;
    user-select: none;

    background-color: #080b11;
    background-image:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 24px 24px;
}

.design-viewport.panning {
    cursor: grabbing;
}

.design-scene {
    position: absolute;
    left: 0;
    top: 0;
    width: 2200px;
    height: 1400px;
    transform-origin: 0 0;
}

.design-edges {
    position: absolute;
    inset: 0;
    width: 2200px;
    height: 1400px;
    overflow: visible;
}

.design-nodes {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.design-node {
    position: absolute;
    width: 245px;
    min-height: 118px;
    padding: 14px;

    border: 1px solid rgba(255,255,255,.11);
    border-radius: 14px;

    background:
        linear-gradient(
            180deg,
            rgba(27,32,44,.98),
            rgba(15,18,26,.98)
        );

    box-shadow:
        0 14px 35px rgba(0,0,0,.28);

    cursor: move;
    pointer-events: auto;
    touch-action: none;

    transition:
        border-color .14s,
        box-shadow .14s,
        opacity .14s;
}

.design-node:hover {
    border-color: rgba(255,173,13,.35);
}

.design-node.selected {
    border-color: rgba(255,173,13,.8);
    box-shadow:
        0 0 0 3px rgba(255,173,13,.08),
        0 18px 46px rgba(0,0,0,.34);
}

.design-node.connected {
    border-color: rgba(105,167,255,.55);
}

.design-node.dimmed {
    opacity: .38;
}

.node-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.node-type {
    color: var(--accent);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.node-id {
    color: #545f73;
    font-size: 9px;
}

.node-name {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    line-height: 1.3;
}

.node-purpose {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.node-component-state {
    margin-top: 11px;
    padding-top: 9px;
    border-top: 1px solid rgba(255,255,255,.055);
    color: #707b8f;
    font-size: 10px;
}

.edge-path {
    fill: none;
    stroke: #566176;
    stroke-width: 2;
    opacity: .82;
}

.edge-path.power {
    stroke: var(--accent);
    stroke-width: 2.4;
}

.edge-path.bus {
    stroke: var(--blue);
}

.edge-path.highlighted {
    opacity: 1;
    stroke-width: 3.4;
}

.edge-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 18;
    cursor: pointer;
    pointer-events: stroke;
}

.edge-label {
    fill: #9ba6b9;
    font-size: 10px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: middle;

    paint-order: stroke;
    stroke: #080b11;
    stroke-width: 6px;
    stroke-linejoin: round;

    pointer-events: none;
}

.inspector {
    padding: 19px;
    min-height: 320px;
}

.inspector-eyebrow {
    margin-bottom: 7px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.inspector h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.inspector-text {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.inspector-section {
    margin-top: 17px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.inspector-label {
    margin-bottom: 6px;
    color: #6e788a;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.inspector-value {
    color: #d8dde7;
    font-size: 12px;
    line-height: 1.55;
}

.inspector-actions {
    margin-top: 18px;
}

.inspector-actions button {
    width: 100%;
}

.architecture-notes {
    margin-top: 18px;
    padding: 20px;
}

.notes-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.notes-columns h4 {
    margin: 0 0 9px;
}

.notes-columns ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.architecture-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
}

.architecture-status {
    color: var(--muted);
    font-size: 12px;
}

.architecture-actions {
    display: flex;
    gap: 9px;
}

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

    .design-viewport {
        height: 560px;
    }
}

@media (max-width: 700px) {
    .result-head-row,
    .architecture-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .clarification-answer-row,
    .notes-columns {
        grid-template-columns: 1fr;
    }

    .architecture-actions {
        flex-direction: column;
    }

    .graph-toolbar-title span {
        display: none;
    }
}

.architecture-modal {
    position: fixed;
    inset: 0;
    z-index: 5000;

    display: grid;
    place-items: center;

    padding: 24px;

    background:
        rgba(3,5,9,.76);

    backdrop-filter:
        blur(8px);
}

.architecture-modal.hidden {
    display: none;
}

.architecture-modal-card {
    width:
        min(
            720px,
            100%
        );

    padding: 22px;

    border:
        1px solid
        rgba(255,255,255,.11);

    border-radius: 17px;

    background:
        #11151e;

    box-shadow:
        0 28px 100px
        rgba(0,0,0,.58);
}

.architecture-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 15px;
}

.architecture-modal-head h3 {
    margin: 0 0 5px;
}

.architecture-modal-head p {
    margin: 0;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.5;
}

.architecture-modal-close {
    width: 36px;
    height: 36px;

    border:
        1px solid
        var(--line);

    border-radius: 9px;

    background:
        rgba(255,255,255,.025);

    color: #cdd3dd;

    cursor: pointer;
}

#architecture-revision-text {
    width: 100%;
    min-height: 180px;

    padding: 15px;

    border:
        1px solid
        rgba(255,255,255,.10);

    border-radius: 12px;

    outline: 0;

    resize: vertical;

    background:
        #080b11;

    color:
        var(--text);

    line-height: 1.6;
}

#architecture-revision-text:focus {
    border-color:
        rgba(255,173,13,.55);
}

.architecture-modal-examples {
    margin-top: 10px;

    color:
        #667186;

    font-size:
        11px;

    line-height:
        1.55;
}

.architecture-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;

    margin-top: 18px;
}

.danger-button {
    width: 100%;

    margin-top: 9px;

    padding: 10px;

    border:
        1px solid
        rgba(255,107,118,.25);

    border-radius: 9px;

    background:
        rgba(255,107,118,.055);

    color:
        #ff9ca5;

    cursor: pointer;
}

.danger-button:hover {
    background:
        rgba(255,107,118,.10);
}


/* =========================================================
   COMPONENT SELECTOR
   ========================================================= */

.component-modal {
    position: fixed;
    inset: 0;
    z-index: 6000;

    display: grid;
    place-items: center;

    padding: 24px;

    background: rgba(2, 4, 8, .82);
    backdrop-filter: blur(9px);
}

.component-modal.hidden {
    display: none;
}

.component-modal-card {
    width: min(980px, 100%);
    max-height: min(850px, calc(100vh - 48px));

    display: flex;
    flex-direction: column;

    border: 1px solid rgba(255,255,255,.11);
    border-radius: 18px;

    overflow: hidden;

    background: #11151e;

    box-shadow:
        0 35px 120px
        rgba(0,0,0,.65);
}

.component-modal-head {
    padding: 19px 20px;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;

    border-bottom: 1px solid var(--line);
}

.component-modal-head h3 {
    margin: 0 0 5px;
}

.component-modal-subtitle {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.component-modal-close {
    width: 38px;
    height: 38px;

    flex: 0 0 auto;

    border: 1px solid var(--line);
    border-radius: 10px;

    background: rgba(255,255,255,.025);
    color: #d5dae3;

    cursor: pointer;
}

.component-requirements {
    padding: 12px 20px;

    display: flex;
    flex-wrap: wrap;
    gap: 6px;

    border-bottom: 1px solid var(--line);
}

.component-requirement {
    padding: 5px 8px;

    border: 1px solid var(--line);
    border-radius: 999px;

    background: rgba(255,255,255,.025);

    color: #aeb6c5;
    font-size: 10px;
}

.component-candidates {
    padding: 14px;

    overflow: auto;

    display: grid;
    gap: 10px;
}

.component-candidate {
    padding: 15px;

    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: 14px;

    border: 1px solid var(--line);
    border-radius: 13px;

    background: rgba(6,8,13,.55);
}

.component-candidate:hover {
    border-color: rgba(255,173,13,.30);
}

.component-candidate.best {
    border-color: rgba(76,215,144,.30);
}

.component-candidate-main {
    min-width: 0;
}

.component-candidate-mpn {
    margin-bottom: 3px;

    color: #f3f5fa;

    font-size: 15px;
    font-weight: 760;
}

.component-candidate-meta {
    color: var(--muted);

    font-size: 11px;
    line-height: 1.55;
}

.component-candidate-tags {
    margin-top: 9px;

    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.candidate-tag {
    padding: 4px 6px;

    border-radius: 6px;

    background: rgba(105,167,255,.08);
    color: #94bdff;

    font-size: 9px;
}

.candidate-tag.good {
    background: rgba(76,215,144,.08);
    color: #72dfaa;
}

.candidate-tag.bad {
    background: rgba(255,107,118,.08);
    color: #ff929c;
}

.component-score {
    margin-bottom: 8px;

    text-align: right;

    color: #727d8f;
    font-size: 10px;
}

.component-select-button {
    min-width: 105px;
}

.component-modal-empty {
    padding: 45px;

    color: var(--muted);

    text-align: center;
    line-height: 1.6;
}


/* =========================================================
   BLOCK COMPONENT SLOTS
   ========================================================= */

.block-slot-list {
    margin-top: 13px;

    display: grid;
    gap: 8px;
}

.block-slot {
    padding: 10px;

    border: 1px solid var(--line);
    border-radius: 10px;

    background: rgba(5,7,11,.42);
}

.block-slot-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.block-slot-role {
    font-size: 11px;
    font-weight: 700;
}

.block-slot-qty {
    color: #687386;
    font-size: 10px;
}

.block-slot-selected {
    margin-top: 6px;

    color: var(--green);

    font-size: 11px;
}

.block-slot-empty {
    margin-top: 6px;

    color: #747e90;

    font-size: 11px;
}

.block-slot button {
    width: 100%;

    margin-top: 8px;
}


/* =========================================================
   BOM EDITOR
   ========================================================= */

#bom-panel {
    margin-top: 18px;
}

.bom-header {
    padding: 21px;
}

.bom-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.bom-header h2 {
    margin: 0 0 7px;
}

.bom-header p {
    margin: 0;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.6;
}

.bom-progress {
    color: var(--accent-2);

    font-size: 11px;
    white-space: nowrap;
}

.bom-group {
    margin-top: 14px;

    border: 1px solid var(--line);
    border-radius: 15px;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            rgba(23,27,37,.94),
            rgba(14,17,24,.94)
        );
}

.bom-group-head {
    padding: 12px 15px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    border-bottom: 1px solid var(--line);

    background: rgba(255,255,255,.018);
}

.bom-group-head strong {
    font-size: 13px;
}

.bom-group-count {
    color: #677286;
    font-size: 10px;
}

.bom-table {
    width: 100%;

    border-collapse: collapse;

    font-size: 11px;
}

.bom-table th {
    padding: 9px 12px;

    color: #667185;

    text-align: left;

    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;

    border-bottom: 1px solid var(--line);
}

.bom-table td {
    padding: 12px;

    border-bottom:
        1px solid
        rgba(255,255,255,.045);

    vertical-align: top;
}

.bom-table tr:last-child td {
    border-bottom: 0;
}

.bom-role {
    color: #dce1e9;
    font-weight: 650;
}

.bom-block-name {
    margin-top: 3px;

    color: #606b7d;

    font-size: 9px;
}

.bom-mpn {
    font-size: 12px;
    font-weight: 750;
}

.bom-component-meta {
    margin-top: 3px;

    color: var(--muted);

    font-size: 10px;
}

.bom-source {
    display: inline-flex;

    margin-top: 5px;

    padding: 3px 6px;

    border-radius: 5px;

    font-size: 8px;
}

.bom-source.user {
    background: rgba(255,173,13,.09);
    color: var(--accent-2);
}

.bom-source.auto {
    background: rgba(105,167,255,.08);
    color: #96bdff;
}

.bom-unresolved {
    color: #ff929c;
}

.bom-action {
    white-space: nowrap;
}

.bom-footer {
    margin-top: 15px;

    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.bom-footer-note {
    color: var(--muted);

    font-size: 11px;
}

.node-component-state.selected-part {
    color: var(--green);
}

.node-component-state.partial-part {
    color: var(--accent-2);
}

@media (max-width: 800px) {
    .component-candidate {
        grid-template-columns: 1fr;
    }

    .component-score {
        text-align: left;
    }

    .bom-table {
        min-width: 760px;
    }

    .bom-group {
        overflow-x: auto;
    }
}


/* ===== BOM UNIFIED TABLE STYLE START ===== */


/* ---------------------------------------------------------
 * BOM HEADER
 * --------------------------------------------------------- */

.bom-header h2 {
    font-size: 27px;
    line-height: 1.15;
    font-weight: 700;
}

.bom-header p {
    font-size: 14px;
    line-height: 1.5;
}

#bom-progress {
    font-size: 14px;
    font-weight: 600;
}


/* ---------------------------------------------------------
 * ONE TABLE
 * --------------------------------------------------------- */

#bom-groups {
    display: block;
    width: 100%;
}

#bom-groups .bom-table-wrap {
    width: 100%;
    overflow-x: auto;

    border:
        1px solid
        rgba(255, 255, 255, .08);

    border-radius: 16px;

    background:
        rgba(10, 14, 23, .46);
}


#bom-groups .bom-table-unified {
    width: 100%;

    min-width: 980px;

    table-layout: fixed;

    border-collapse: collapse;

    border-spacing: 0;
}


/* ---------------------------------------------------------
 * COLUMN HEADER
 * --------------------------------------------------------- */

#bom-groups
.bom-table-unified
thead
th {
    padding:
        13px
        16px;

    text-align: left;

    vertical-align: middle;

    font-size: 13px;
    line-height: 1.25;

    font-weight: 650;

    letter-spacing: .035em;

    color:
        rgba(181, 194, 219, .82);

    border-bottom:
        1px solid
        rgba(255, 255, 255, .075);

    background:
        #171c27;

    white-space: nowrap;
}


/*
 * Количество по центру.
 */
#bom-groups
.bom-table-unified
thead
th:nth-child(2),

#bom-groups
.bom-table-unified
tbody
.bom-item-row
td:nth-child(2) {
    text-align: center;
}


/*
 * Кнопка справа.
 */
#bom-groups
.bom-table-unified
thead
th:last-child,

#bom-groups
.bom-table-unified
tbody
.bom-item-row
td:last-child {
    text-align: right;
}


/* ---------------------------------------------------------
 * GROUP SEPARATORS
 * --------------------------------------------------------- */

#bom-groups
.bom-section-row
td {
    padding: 0 !important;

    border-top:
        1px solid
        rgba(255, 255, 255, .085);

    border-bottom:
        1px solid
        rgba(255, 255, 255, .07);

    background:
        rgba(255, 255, 255, .035);
}


#bom-groups
.bom-section-row:first-child
td {
    border-top: 0;
}


#bom-groups
.bom-section-row
.bom-group-head {
    display: flex;

    align-items: center;

    justify-content:
        space-between;

    gap: 16px;

    width: 100%;

    margin: 0;

    padding:
        12px
        16px;
}


#bom-groups
.bom-section-row
.bom-group-head {
    font-size: 16px;
    line-height: 1.3;

    font-weight: 700;

    color: #f3f6fc;
}


#bom-groups
.bom-group-count {
    font-size: 12px;
    line-height: 1.2;

    font-weight: 500;

    color:
        rgba(180, 193, 217, .62);

    white-space: nowrap;
}


/* ---------------------------------------------------------
 * NORMAL BOM ROWS
 * --------------------------------------------------------- */

#bom-groups
.bom-item-row
td {
    padding:
        14px
        16px;

    vertical-align: middle;

    font-size: 14px;
    line-height: 1.42;

    color:
        rgba(232, 238, 249, .90);

    border-bottom:
        1px solid
        rgba(255, 255, 255, .05);
}


#bom-groups
.bom-item-row:last-child
td {
    border-bottom: 0;
}


#bom-groups
.bom-item-row:hover
td {
    background:
        rgba(255, 255, 255, .018);
}


/* ---------------------------------------------------------
 * ROLE
 * --------------------------------------------------------- */

#bom-groups
.bom-role {
    font-size: 15px;
    line-height: 1.35;

    font-weight: 600;

    color: #eef3fc;
}


#bom-groups
.bom-role strong,

#bom-groups
.bom-role-name {
    font-size: 15px;
    line-height: 1.35;

    font-weight: 650;

    color: #f3f6fc;
}


#bom-groups
.bom-role small,

#bom-groups
.bom-role-desc {
    display: block;

    margin-top: 3px;

    font-size: 12.5px;
    line-height: 1.35;

    font-weight: 400;

    color:
        rgba(169, 183, 210, .63);
}


/* ---------------------------------------------------------
 * COMPONENT
 * --------------------------------------------------------- */

#bom-groups
.bom-component {
    font-size: 14px;
    line-height: 1.4;
}


#bom-groups
.bom-component
strong {
    font-size: 15px;

    font-weight: 650;

    color: #f2f6ff;
}


/* ---------------------------------------------------------
 * SELECT BUTTON
 * --------------------------------------------------------- */

#bom-groups
.bom-replace {
    min-width: 106px;

    padding:
        9px
        13px;

    font-size: 13.5px;
    line-height: 1.2;

    font-weight: 600;

    white-space: nowrap;
}


/* ---------------------------------------------------------
 * RESPONSIVE
 * --------------------------------------------------------- */

@media (
    max-width: 1100px
) {
    #bom-groups
    .bom-table-unified {
        min-width: 900px;
    }
}


/* ===== BOM UNIFIED TABLE STYLE END ===== */

