/* THE BLUEPRINT PAGE (/blueprint - docs/claude/BLUEPRINT.md "The Portal"). Owns every .bp-* class and nothing else; --theme-* and
   --conv-* tokens only (the page sits inside .conv-builder, so a workspace theme - dark included - re-skins it for free). */

.bp-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    min-height: calc(100vh - 120px);
}

.bp-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.bp-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-text-emphasis);
}

.bp-sub {
    margin: 4px 0 0;
    color: var(--theme-text-secondary);
}

.bp-pick {
    position: relative;
}

.bp-pick-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    width: min(420px, calc(100vw - 32px));
    padding: 10px;
    background: var(--conv-node-bg);
    border: 1px solid var(--conv-node-border);
    border-radius: var(--theme-radius);
    box-shadow: var(--theme-shadow-lg);
}

.bp-pick-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
}

.bp-pick-row {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--theme-radius-button);
    background: transparent;
    color: var(--theme-text);
    text-align: left;
    cursor: pointer;
}

.bp-pick-row:hover,
.bp-pick-row.is-on {
    background: color-mix(in srgb, var(--theme-primary) 10%, var(--conv-node-bg));
}

.bp-pick-name {
    font-weight: 600;
}

.bp-pick-meta,
.bp-muted,
.bp-hint {
    color: var(--theme-text-secondary);
    font-size: 0.85rem;
}

.bp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 16px;
    color: var(--theme-text-secondary);
    background: var(--conv-node-bg);
    border: 1px dashed var(--conv-node-border);
    border-radius: var(--theme-radius);
    text-align: center;
}

.bp-empty .bi {
    font-size: 2rem;
}

.bp-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--theme-border);
}

.bp-tab {
    padding: 8px 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--theme-text-secondary);
    font-weight: 600;
    cursor: pointer;
}

.bp-tab.is-active {
    color: var(--theme-text-emphasis);
    border-bottom-color: var(--theme-primary);
}

.bp-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
}

.bp-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 16px;
    align-items: start;
}

.bp-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
    background: var(--conv-node-bg);
    border: 1px solid var(--conv-node-border);
    border-radius: var(--theme-radius);
    box-shadow: var(--theme-shadow);
}

.bp-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bp-group-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--theme-text-secondary);
}

.bp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bp-chip {
    padding: 4px 10px;
    border: 1px solid var(--conv-node-border);
    border-radius: var(--theme-radius-button);
    background: var(--theme-background);
    color: var(--theme-text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--conv-motion);
}

.bp-chip.is-on {
    border-color: var(--theme-primary);
    background: color-mix(in srgb, var(--theme-primary) 14%, var(--conv-node-bg));
    color: var(--theme-text-emphasis);
    font-weight: 600;
}

.bp-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--theme-text);
    cursor: pointer;
}

.bp-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.bp-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bp-danger {
    color: var(--theme-danger);
}

.bp-notice {
    margin: 0;
    font-size: 0.85rem;
    color: var(--theme-text);
}

.bp-notice.is-problem {
    color: var(--theme-danger);
}

.bp-preview {
    position: relative;
    min-height: 70vh;
    background: var(--conv-canvas-bg);
    border: 1px solid var(--conv-node-border);
    border-radius: var(--theme-radius);
    overflow: hidden;
}

.bp-frame {
    display: block;
    width: 100%;
    height: 78vh;
    border: 0;
    background: var(--theme-background);
}

.bp-printing {
    position: absolute;
    top: 10px;
    right: 12px;
    padding: 4px 10px;
    border-radius: var(--theme-radius-button);
    background: var(--conv-node-bg);
    color: var(--theme-text-secondary);
    font-size: 0.8rem;
    box-shadow: var(--theme-shadow);
}

.bp-translations {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 860px;
}

.bp-drop {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px;
    border: 1px dashed var(--conv-node-border);
    border-radius: var(--theme-radius);
    background: var(--conv-node-bg);
    color: var(--theme-text);
    cursor: pointer;
}

.bp-drop input[type="file"] {
    margin-left: auto;
}

.bp-plan {
    width: 100%;
    border-collapse: collapse;
    background: var(--conv-node-bg);
    border: 1px solid var(--conv-node-border);
    border-radius: var(--theme-radius);
}

.bp-plan th,
.bp-plan td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--theme-border-subtle);
    text-align: left;
    color: var(--theme-text);
}

.bp-plan th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--theme-text-secondary);
}

/* The pick control's click-away (the house popover). */
.bp-pick-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    background: transparent;
}

/* A render that no longer matches the controls (a refresh running, or one that failed): dimmed, and Print is off. */
.bp-frame.is-stale {
    opacity: 0.45;
    filter: grayscale(0.4);
    transition: var(--conv-motion);
}

/* The first load: a skeleton in the page's shape, never a spinner in an empty field. */
.bp-skel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 32px;
}

.bp-skel-line,
.bp-skel-block {
    display: block;
    height: 14px;
    width: 60%;
    border-radius: var(--theme-radius-button);
    background: color-mix(in srgb, var(--theme-border) 60%, var(--conv-node-bg));
}

.bp-skel-line.is-wide {
    width: 85%;
    height: 22px;
}

.bp-skel-block {
    width: 100%;
    height: 96px;
    border-radius: var(--theme-radius);
}

/* The two-tap delete: armed, it asks. */
.bp-danger.is-confirm {
    border-color: var(--theme-danger);
    font-weight: 600;
}

/* A coarse pointer (a phone, a tablet): every target 44px, every input 16px so it never zooms. */
@media (pointer: coarse) {
    .bp-tab,
    .bp-chip,
    .bp-pick-row,
    .bp-switch,
    .bp-controls .conv-btn,
    .bp-row .conv-btn,
    .bp-pick .conv-btn {
        min-height: 44px;
    }

    .bp-pick-panel input,
    .bp-row .conv-input,
    .bp-row .conv-select {
        font-size: 16px;
        min-height: 44px;
    }
}

/* Phone width: the controls stack above the preview. */
@media (max-width: 860px) {
    .bp-layout {
        grid-template-columns: 1fr;
    }

    .bp-frame {
        height: 70vh;
    }
}
