/* 独立创作产品页：从创编中心抽出单页工作台范式，产品心智独立。 */
:root {
    --cpw-bg: #f6f3ee;
    --cpw-card: rgba(255, 255, 255, 0.88);
    --cpw-line: rgba(55, 48, 43, 0.12);
    --cpw-ink: #28241f;
    --cpw-muted: #736a60;
    --cpw-shadow: 0 24px 60px rgba(49, 42, 35, 0.12);
    --cpw-accent: #7164df;
    --cpw-accent-soft: rgba(113, 100, 223, 0.12);
    --cpw-good: #4b7a61;
}

body.product-shell-body:has(.cpw-page) {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 10%, rgba(113, 100, 223, 0.14), transparent 26%),
        radial-gradient(circle at 88% 12%, rgba(231, 166, 104, 0.16), transparent 24%),
        linear-gradient(180deg, #fbfaf7 0%, var(--cpw-bg) 100%);
    color: var(--cpw-ink);
}

.product-shell-main:has(.cpw-page) {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    padding: clamp(14px, 2vw, 28px);
}

.cpw-page {
    --cpw-product: var(--cpw-accent);
    --cpw-product-soft: var(--cpw-accent-soft);
    display: grid;
    gap: 16px;
    min-height: calc(100vh - clamp(28px, 4vw, 56px));
}

.cpw-page--meiyu {
    --cpw-product: #6c62d8;
    --cpw-product-soft: rgba(108, 98, 216, 0.13);
}

.cpw-page--heritage {
    --cpw-product: #9c6b2f;
    --cpw-product-soft: rgba(156, 107, 47, 0.14);
}

.cpw-brand {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 16px 18px;
    border: 1px solid var(--cpw-line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: var(--cpw-shadow);
    backdrop-filter: blur(14px);
}

.cpw-back {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--cpw-product);
    background: var(--cpw-product-soft);
    font-size: 22px;
    font-weight: 800;
}

.cpw-eyebrow,
.cpw-panel-kicker,
.cpw-card-kicker {
    margin: 0 0 6px;
    color: var(--cpw-product);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.cpw-brand h1,
.cpw-panel h2,
.cpw-output h2,
.cpw-prompt-card h2,
.cpw-detail h3 {
    margin: 0;
    color: var(--cpw-ink);
}

.cpw-brand h1 {
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1;
}

.cpw-lead {
    margin: 8px 0 0;
    color: var(--cpw-muted);
    line-height: 1.65;
}

.cpw-mode-pill,
.cpw-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--cpw-product);
    background: var(--cpw-product-soft);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.cpw-shell {
    display: grid;
    grid-template-columns: minmax(220px, 0.72fr) minmax(360px, 1.25fr) minmax(300px, 0.9fr);
    gap: 14px;
    min-height: 0;
}

.cpw-rail,
.cpw-chat,
.cpw-output {
    min-width: 0;
}

.cpw-rail {
    display: grid;
    gap: 14px;
    align-content: start;
}

.cpw-panel,
.cpw-chat,
.cpw-output,
.cpw-prompt-card,
.cpw-detail,
.cpw-ops-summary {
    border: 1px solid var(--cpw-line);
    border-radius: 22px;
    background: var(--cpw-card);
    box-shadow: 0 16px 40px rgba(49, 42, 35, 0.08);
}

.cpw-panel,
.cpw-output {
    padding: 16px;
}

.cpw-panel h2,
.cpw-output h2 {
    font-size: 20px;
}

.cpw-list,
.cpw-source-stack {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.cpw-list-item,
.cpw-source-stack span,
.cpw-tile {
    border: 1px solid var(--cpw-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
}

.cpw-list-item {
    cursor: pointer;
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 12px;
    color: var(--cpw-ink);
    text-align: left;
}

.cpw-list-item.is-active {
    border-color: color-mix(in srgb, var(--cpw-product) 42%, transparent);
    background: var(--cpw-product-soft);
}

.cpw-list-item:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--cpw-product) 32%, transparent);
    outline-offset: 2px;
}

.cpw-list-item span {
    font-weight: 800;
}

.cpw-list-item small,
.cpw-source-stack span,
.cpw-message,
.cpw-prompt-card p,
.cpw-detail p {
    color: var(--cpw-muted);
    line-height: 1.6;
}

.cpw-source-stack span {
    padding: 10px 12px;
}

.cpw-material-box {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.cpw-material-box span {
    color: var(--cpw-muted);
    font-size: 12px;
    font-weight: 900;
}

.cpw-material-box textarea {
    resize: vertical;
    min-height: 94px;
    border: 1px solid var(--cpw-line);
    border-radius: 16px;
    padding: 12px;
    color: var(--cpw-ink);
    background: rgba(255, 255, 255, 0.82);
    font: inherit;
    line-height: 1.45;
}

.cpw-chat {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
}

.cpw-chat-scroll {
    display: grid;
    align-content: end;
    gap: 12px;
    min-height: 420px;
    padding: 18px;
}

.cpw-message {
    max-width: 78%;
    padding: 14px 16px;
    border-radius: 20px 20px 20px 6px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(49, 42, 35, 0.06);
}

.cpw-message p,
.cpw-prompt-card p,
.cpw-detail p {
    margin: 0;
}

.cpw-prompt-card,
.cpw-detail,
.cpw-ops-summary {
    padding: 16px;
}

.cpw-prompt-card h2 {
    margin-bottom: 8px;
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1.18;
}

.cpw-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--cpw-line);
    background: rgba(255, 255, 255, 0.72);
}

.cpw-composer textarea {
    resize: none;
    min-height: 46px;
    max-height: 120px;
    border: 1px solid var(--cpw-line);
    border-radius: 18px;
    padding: 13px 14px;
    color: var(--cpw-ink);
    background: #fff;
    font: inherit;
    line-height: 1.35;
}

.cpw-send,
.cpw-primary {
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    color: #fff;
    background: var(--cpw-product);
    font-weight: 900;
    box-shadow: 0 14px 30px color-mix(in srgb, var(--cpw-product) 24%, transparent);
}

.cpw-send {
    padding: 0 18px;
}

.cpw-send:disabled,
.cpw-primary:disabled {
    cursor: wait;
    opacity: 0.68;
}

.cpw-output {
    display: grid;
    gap: 14px;
    align-content: start;
}

.cpw-output-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.cpw-tile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.cpw-tile {
    cursor: pointer;
    min-height: 82px;
    padding: 10px;
    color: var(--cpw-ink);
    text-align: left;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.cpw-tile:hover,
.cpw-tile.is-active {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--cpw-product) 46%, transparent);
    background: var(--cpw-product-soft);
}

.cpw-tile span {
    display: block;
    color: var(--cpw-muted);
    font-size: 12px;
    font-weight: 700;
}

.cpw-tile strong {
    display: block;
    margin-top: 10px;
    font-size: 16px;
}

.cpw-tile.is-ready strong {
    color: var(--cpw-good);
}

.cpw-primary {
    min-height: 48px;
    padding: 0 18px;
    font-size: 15px;
}

.cpw-draft-cards {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.cpw-ops-summary {
    display: grid;
    gap: 10px;
}

.cpw-ops-summary > p {
    margin: 0;
    color: var(--cpw-muted);
    line-height: 1.6;
}

.cpw-ops-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.cpw-ops-grid article {
    border: 1px solid var(--cpw-line);
    border-radius: 14px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.cpw-ops-grid span {
    color: var(--cpw-muted);
    font-size: 12px;
    font-weight: 800;
}

.cpw-ops-grid strong {
    display: block;
    margin-top: 4px;
    color: var(--cpw-ink);
    font-size: 22px;
}

.cpw-ops-grid p {
    margin: 4px 0 0;
    color: var(--cpw-muted);
    font-size: 12px;
}

.cpw-material-summary,
.cpw-draft-cards article {
    border: 1px solid var(--cpw-line);
    border-radius: 14px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.cpw-material-summary {
    margin: 12px 0;
}

.cpw-draft-cards span,
.cpw-material-summary span,
.cpw-next-step {
    color: var(--cpw-muted);
    font-size: 12px;
    font-weight: 800;
}

.cpw-material-summary strong,
.cpw-draft-cards strong {
    display: block;
    margin-top: 4px;
    color: var(--cpw-ink);
}

.cpw-drawer[hidden] {
    display: none;
}

.cpw-drawer {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    align-items: end;
    padding: 24px;
    background: rgba(40, 36, 31, 0.28);
}

.cpw-drawer-card {
    width: min(760px, 100%);
    max-height: min(86vh, 760px);
    margin-left: auto;
    overflow: auto;
    border: 1px solid var(--cpw-line);
    border-radius: 24px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--cpw-shadow);
}

.cpw-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.cpw-drawer-card h2,
.cpw-export-preview h3 {
    margin: 0;
}

.cpw-drawer-card label {
    display: grid;
    gap: 7px;
    margin-top: 10px;
    color: var(--cpw-muted);
    font-size: 13px;
    font-weight: 900;
}

.cpw-drawer-card input,
.cpw-drawer-card textarea {
    width: 100%;
    border: 1px solid var(--cpw-line);
    border-radius: 14px;
    padding: 11px 12px;
    color: var(--cpw-ink);
    background: #fff;
    font: inherit;
}

.cpw-close,
.cpw-export-actions button {
    border: 1px solid var(--cpw-line);
    border-radius: 999px;
    cursor: pointer;
    padding: 9px 13px;
    color: var(--cpw-product);
    background: var(--cpw-product-soft);
    font-weight: 900;
}

.cpw-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.cpw-export-preview,
.cpw-export-list article,
.cpw-file-list span {
    border: 1px solid var(--cpw-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
}

.cpw-export-preview {
    padding: 14px;
}

.cpw-export-list {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.cpw-export-list article {
    padding: 10px;
}

.cpw-export-list span,
.cpw-file-list span {
    color: var(--cpw-muted);
    font-size: 12px;
    font-weight: 800;
}

.cpw-export-list strong {
    display: block;
    margin-top: 4px;
    color: var(--cpw-ink);
}

.cpw-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.cpw-file-list span {
    padding: 8px 10px;
}

.cpw-publish-check {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    border: 1px solid var(--cpw-line);
    border-radius: 18px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.78);
}

.cpw-publish-check p {
    margin: 0;
    color: var(--cpw-muted);
    line-height: 1.6;
}

.cpw-publish-check button {
    justify-self: start;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    padding: 10px 16px;
    color: #fff;
    background: var(--cpw-product);
    font-weight: 900;
}

.cpw-gate-result {
    border: 1px solid var(--cpw-line);
    border-radius: 14px;
    padding: 10px;
    background: var(--cpw-product-soft);
}

.cpw-gate-result.is-ready {
    border-color: color-mix(in srgb, var(--cpw-good) 46%, transparent);
    background: rgba(75, 122, 97, 0.12);
}

.cpw-gate-result strong,
.cpw-gate-result span {
    display: block;
}

.cpw-gate-result strong {
    color: var(--cpw-ink);
}

.cpw-gate-result span {
    color: var(--cpw-muted);
    font-size: 12px;
    font-weight: 800;
}

.cpw-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1100px) {
    .cpw-shell {
        grid-template-columns: 1fr;
    }

    .cpw-chat-scroll {
        min-height: 300px;
    }
}

@media (max-width: 680px) {
    .product-shell-main:has(.cpw-page) {
        padding: 10px;
    }

    .cpw-brand,
    .cpw-composer {
        grid-template-columns: 1fr;
    }

    .cpw-back {
        position: absolute;
        top: 18px;
        left: 18px;
    }

    .cpw-brand {
        padding-top: 68px;
    }

    .cpw-mode-pill {
        justify-self: start;
    }

    .cpw-tile-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cpw-drawer {
        padding: 10px;
    }
}
