.schematic-detail-page {
    background: var(--bg-page);
    min-height: 60vh;
}

.schematic-detail-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 64px;
}

.schematic-detail-heading {
    margin-bottom: 28px;
}

.schematic-detail-heading .ch-caption {
    color: var(--clevr-blue-600);
}

.schematic-detail-heading .ch-h1 {
    margin: 8px 0 0;
}

.schematic-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 28px;
    align-items: start;
}

.schematic-detail-main,
.schematic-sidebar-stack {
    display: grid;
    gap: 22px;
    min-width: 0;
}

.schematic-detail-sidebar {
    min-width: 0;
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding-right: 4px;
}

.schematic-detail-card {
    background: #fff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.schematic-detail-card h3,
.schematic-page-menu h3,
.schematic-bom-head h3 {
    color: var(--fg-1);
    font: 700 20px/1.25 var(--font-body);
    margin: 0 0 14px;
}

.schematic-gallery {
    padding: 14px;
    overflow: hidden;
}

.schematic-main-image-wrap {
    aspect-ratio: 16 / 10;
    background: #fff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.schematic-main-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.schematic-thumb-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 2px 2px;
    scrollbar-width: none;
}

.schematic-thumb-row::-webkit-scrollbar {
    display: none;
}

.schematic-thumb {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: #fff;
    cursor: pointer;
    padding: 5px;
    transition: border-color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-fast) var(--ease-standard);
}

.schematic-thumb:hover,
.schematic-thumb.is-active {
    border-color: var(--clevr-blue-500);
    box-shadow: 0 0 0 2px var(--clevr-blue-100);
}

.schematic-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.schematic-copy {
    color: var(--fg-2);
    font: 400 16px/1.65 var(--font-body);
}

.schematic-copy > *:first-child {
    margin-top: 0;
}

.schematic-copy > *:last-child {
    margin-bottom: 0;
}

.schematic-copy p {
    margin: 0 0 14px;
}

.schematic-copy ul,
.schematic-copy ol {
    color: var(--fg-2);
    margin: 0 0 16px;
    padding-left: 24px;
}

.schematic-copy ul {
    list-style: disc;
}

.schematic-copy ol {
    list-style: decimal;
}

.schematic-copy li {
    margin: 6px 0;
    padding-left: 2px;
}

.schematic-copy h1,
.schematic-copy h2,
.schematic-copy h3 {
    color: var(--fg-1);
    line-height: 1.25;
}

.schematic-page-menu ul,
.schematic-related-list,
.schematic-file-list,
.schematic-bom-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.schematic-page-menu ul {
    display: grid;
    gap: 8px;
}

.schematic-page-menu a {
    color: var(--fg-link);
    font: 600 14px var(--font-body);
    text-decoration: none;
}

.schematic-page-menu a:hover {
    color: var(--fg-link-hover);
}

.schematic-access-card p {
    color: var(--fg-2);
    font: 700 14px var(--font-body);
    margin: 0 0 6px;
}

.schematic-access-card strong {
    color: var(--fg-brand);
    display: block;
    font: 800 30px var(--font-mono);
    margin-bottom: 14px;
}

.schematic-access-card form {
    display: grid;
    gap: 10px;
}

.schematic-access-card button,
.schematic-buy-file-btn {
    border: 0;
    border-radius: var(--radius-md);
    background: var(--clevr-blue-500);
    color: #fff;
    cursor: pointer;
    font: 700 14px var(--font-body);
    min-height: 42px;
    padding: 10px 15px;
    transition: background var(--motion-fast) var(--ease-standard);
}

.schematic-access-card button:hover,
.schematic-buy-file-btn:hover {
    background: var(--clevr-blue-600);
}

.schematic-feedback {
    color: var(--fg-2);
    font: 600 13px var(--font-body);
    min-height: 20px;
    text-align: center;
}

.schematic-feedback.text-green-500 {
    color: #15803d;
}

.schematic-feedback.text-red-500 {
    color: var(--danger);
}

.schematic-bom-card {
    padding: 0;
    overflow: hidden;
}

.schematic-bom-head {
    border-bottom: 1px solid var(--border-subtle);
    padding: 18px 20px 14px;
}

.schematic-bom-head h3 {
    margin-bottom: 4px;
}

.schematic-bom-head span {
    color: var(--fg-3);
    font: 600 12px var(--font-body);
}

.schematic-bom-list {
    max-height: 300px;
    overflow-y: auto;
}

.schematic-bom-list li + li {
    border-top: 1px solid var(--border-subtle);
}

.schematic-bom-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    color: var(--fg-1);
    padding: 10px 20px;
    text-decoration: none;
}

a.schematic-bom-item:hover {
    background: var(--bg-brand-soft);
}

.schematic-bom-qty {
    background: var(--clevr-blue-50);
    border-radius: 999px;
    color: var(--clevr-blue-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: 700 12px var(--font-mono);
    min-width: 36px;
    padding: 6px 8px;
}

.schematic-bom-name {
    color: var(--fg-1);
    font: 600 13px/1.35 var(--font-body);
    min-width: 0;
}

.schematic-bom-item svg {
    color: var(--fg-link);
    width: 16px;
    height: 16px;
}

.schematic-related-card h3,
.schematic-file-card h3 {
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
}

.schematic-related-list {
    display: grid;
    gap: 10px;
}

.schematic-related-item {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--neutral-50);
    color: var(--fg-1);
    font: 700 13px/1.35 var(--font-body);
    padding: 10px;
    text-decoration: none;
    transition: background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}

.schematic-related-item:hover {
    background: var(--bg-brand-soft);
    border-color: var(--clevr-blue-300);
}

.schematic-related-item img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 4px;
}

.schematic-related-item span {
    min-width: 0;
}

.schematic-related-item svg {
    color: var(--fg-link);
    width: 16px;
    height: 16px;
}

.schematic-file-list {
    display: grid;
    gap: 10px;
}

.schematic-file-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--fg-1);
    font: 700 13px/1.35 var(--font-body);
    padding: 10px;
}

.schematic-file-item.is-unlocked {
    background: rgba(47, 174, 101, 0.08);
    border-color: rgba(47, 174, 101, 0.24);
}

.schematic-file-item.is-manual {
    background: #fffbeb;
    border-color: #fde68a;
}

.schematic-file-item.is-locked {
    background: var(--neutral-50);
}

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

.schematic-icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--fg-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.schematic-icon-btn.is-primary {
    background: var(--clevr-blue-500);
    border-color: var(--clevr-blue-500);
    color: #fff;
}

.schematic-icon-btn svg {
    width: 17px;
    height: 17px;
}

.schematic-file-note {
    color: #854d0e;
    font: 700 12px/1.3 var(--font-body);
    text-align: right;
}

.schematic-code-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.64);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.schematic-code-modal.hidden {
    display: none;
}

.schematic-code-dialog {
    width: min(980px, 100%);
    max-height: 90vh;
    background: #1f2937;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.schematic-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding: 14px 18px;
}

.schematic-code-head h2 {
    font: 700 16px var(--font-body);
    margin: 0;
}

.schematic-code-head button {
    border: 0;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.schematic-code-body {
    overflow: auto;
    padding: 16px;
}

@media (max-width: 980px) {
    .schematic-detail-layout {
        grid-template-columns: 1fr;
    }

    .schematic-detail-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }
}

@media (max-width: 640px) {
    .schematic-detail-shell {
        padding: 36px 16px 48px;
    }

    .schematic-detail-heading .ch-h1 {
        font-size: 36px;
    }

    .schematic-detail-card {
        padding: 18px;
    }

    .schematic-gallery {
        padding: 12px;
    }
}
