/* 策划 · 内容结构：工作台内嵌，点「使用」展开外壳（独立样式） */

.cehua-plan-outline-shell {
    border-radius: 10px;
    transition:
        box-shadow 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.cehua-plan-outline-shell--expanded {
    border: 1px solid var(--border-color, #e5e6eb);
    background: var(--bg-primary, #fff);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
    margin-bottom: 10px;
}

.cehua-plan-outline-shell--expanded .wb-fn-row {
    border-bottom: 1px solid var(--border-color, #e5e6eb);
}

.cehua-plan-outline-shell--result .cehua-plan-outline-form-pane {
    display: none !important;
}
.cehua-plan-outline-shell--form .cehua-plan-outline-result-pane {
    display: none !important;
}

/* 展开/收起动画 */
.cehua-plan-outline-embed {
    margin: 0;
    border: none;
    border-radius: 0;
    background: var(--bg-secondary, #fafafa);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    padding: 0 12px;
    transition:
        max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease,
        padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.cehua-plan-outline-shell--expanded .cehua-plan-outline-embed {
    max-height: 2000px;
    opacity: 1;
    padding: 10px 12px 12px;
}

.cehua-plan-outline-embed .cehua-plan-outline-field {
    margin-bottom: 8px;
}
.cehua-plan-outline-embed .cehua-plan-outline-field label {
    margin-bottom: 3px;
    font-size: 12px;
}
.cehua-plan-outline-embed .cehua-plan-outline-field input[type='text'],
.cehua-plan-outline-embed .cehua-plan-outline-field textarea {
    padding: 7px 10px;
    font-size: 13px;
}
.cehua-plan-outline-embed .cehua-plan-outline-field textarea {
    min-height: 52px;
    max-height: 120px;
}
.cehua-plan-outline-embed .cehua-plan-outline-actions {
    margin-top: 8px;
    padding-top: 0;
}
.cehua-plan-outline-embed .cehua-plan-outline-actions button {
    padding: 7px 14px;
    font-size: 13px;
}

@keyframes cehua-po-pane-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cehua-plan-outline-result-pane {
    animation: cehua-po-pane-fadein 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 320px;
    max-height: min(85vh, 900px);
    padding: 12px 14px 14px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--border-color, #e5e6eb);
    border-radius: 10px;
    overflow: hidden;
}
.cehua-plan-outline-result-pane[hidden] {
    display: none !important;
}

.cehua-po-result-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #e5e6eb);
}

.cehua-po-back-btn {
    border: 1px solid var(--border-color, #e5e6eb);
    background: #fff;
    color: var(--text-primary, #1d2129);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.cehua-po-back-btn:hover {
    background: #f7f8fa;
    border-color: #c9cdd4;
}

.cehua-po-result-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1d2129);
}

.cehua-po-stop-btn {
    border: 1px solid #ffccc7;
    background: #fff2f0;
    color: #cf1322;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.cehua-po-stop-btn:hover {
    background: #fff1f0;
    border-color: #ffa39e;
}

.cehua-po-process-wrap {
    border: 1px solid var(--border-color, #e5e6eb);
    border-radius: 8px;
    background: #fafafa;
    flex-shrink: 0;
}
.cehua-po-process-wrap--closed {
    display: none;
}

.cehua-po-process-log {
    margin: 0;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #4e5969;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 240px;
    overflow-y: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.cehua-po-process-expand {
    align-self: center;
    border: 1px solid var(--border-color, #d9d9d9);
    background: #fff;
    color: #4e5969;
    border-radius: 999px;
    width: 28px;
    height: 24px;
    line-height: 20px;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
}
.cehua-po-process-expand:hover {
    background: #f7f8fa;
}

.cehua-plan-outline-result-body {
    flex: 1;
    min-height: 120px;
    overflow: auto;
    background: #fff;
    color: #1d2129;
    font-size: 14px;
    line-height: 1.65;
    padding: 4px 2px 8px;
}

.cehua-po-stream-plain {
    margin: 0;
    padding: 0;
    background: #fff !important;
    color: #1d2129 !important;
    border: none;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.65;
    max-height: min(58vh, 520px);
    overflow: auto;
}

.cehua-po-stream-status {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary, #86909c);
    margin-bottom: 2px;
    min-height: 1.2em;
    flex-shrink: 0;
}

/* Markdown 结果样式 */
.cehua-po-result-md { max-width: 100%; }
.cehua-po-result-md h1 { font-size: 1.25rem; margin: 1.1em 0 0.5em; font-weight: 700; }
.cehua-po-result-md h2 { font-size: 1.1rem; margin: 1em 0 0.45em; font-weight: 700; }
.cehua-po-result-md h3 { font-size: 1rem; margin: 0.9em 0 0.4em; font-weight: 600; }
.cehua-po-result-md p { margin: 0.5em 0; }
.cehua-po-result-md ul,
.cehua-po-result-md ol { margin: 0.5em 0; padding-left: 1.4em; }
.cehua-po-result-md li { margin: 0.25em 0; }
.cehua-po-result-md strong { font-weight: 600; }
.cehua-po-result-md a { color: #165dff; text-decoration: none; }
.cehua-po-result-md a:hover { text-decoration: underline; }
.cehua-po-result-md code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9em;
    background: #f2f3f5;
    padding: 0.1em 0.35em;
    border-radius: 4px;
}
.cehua-po-result-md pre {
    background: #f7f8fa;
    color: #1d2129;
    padding: 12px 14px;
    border-radius: 8px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid #e5e6eb;
}
.cehua-po-result-md pre code { background: transparent; padding: 0; }
.cehua-po-result-md blockquote {
    margin: 0.6em 0;
    padding: 0.4em 0 0.4em 12px;
    border-left: 3px solid #c9cdd4;
    color: #4e5969;
}
.cehua-po-result-md table { border-collapse: collapse; width: 100%; margin: 0.75em 0; font-size: 13px; }
.cehua-po-result-md th,
.cehua-po-result-md td { border: 1px solid #e5e6eb; padding: 6px 10px; text-align: left; }
.cehua-po-result-md th { background: #f7f8fa; font-weight: 600; }

.cehua-po-result-md-plain { white-space: pre-wrap; word-break: break-word; }

.cehua-plan-outline-embed .cehua-po-result-copy-hint {
    flex-shrink: 0;
    margin: 0;
    padding-top: 4px;
}

.cehua-po-result-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: min(65vh, 560px);
    overflow: auto;
    font-size: 13px;
    line-height: 1.55;
}

.cehua-po-result-empty,
.cehua-po-result-copy-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--text-secondary, #86909c);
}

.cehua-po-result-error {
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #cf1322;
    font-size: 14px;
    line-height: 1.6;
}

/* ── 表单基础样式 ── */
.cehua-plan-outline-field {
    margin-bottom: 14px;
}
.cehua-plan-outline-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4e5969;
    margin-bottom: 6px;
}
.cehua-plan-outline-field .req {
    color: #f53f3f;
    margin-left: 2px;
}
.cehua-plan-outline-field input[type="text"],
.cehua-plan-outline-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e5e6eb;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: #1d2129;
    background: #fafafa;
    outline: none;
}
.cehua-plan-outline-field input[type="text"]:focus,
.cehua-plan-outline-field textarea:focus {
    border-color: #165dff;
    background: #fff;
}
.cehua-plan-outline-field textarea {
    min-height: 88px;
    resize: vertical;
}

.cehua-plan-outline-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 4px;
}
.cehua-plan-outline-actions button {
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}
.cehua-plan-outline-actions .btn-submit {
    background: #165dff;
    color: #fff;
}
.cehua-plan-outline-actions .btn-submit:hover {
    background: #0e42d2;
}
.cehua-plan-outline-actions .btn-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cehua-plan-outline-err {
    font-size: 12px;
    color: #f53f3f;
    margin-top: -6px;
    margin-bottom: 8px;
    min-height: 18px;
}

/* ── 复选框行 ── */
.cehua-po-opt-row {
    margin-bottom: 6px;
}
.cehua-po-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 6px;
    font-weight: 400 !important;
    cursor: pointer;
}

/* ── 历史记录按钮 ── */
.cehua-po-history-btn {
    border: 1px solid var(--border-color, #d9d9d9);
    background: #fff;
    color: #4e5969;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}
.cehua-po-history-btn:hover {
    background: #f7f8fa;
    border-color: #c9cdd4;
}
.cehua-po-history-btn--small {
    padding: 4px 10px;
    font-size: 12px;
    margin-left: auto;
}

.cehua-po-history-clear-btn {
    margin-left: auto;
    border: 1px solid #ffccc7;
    background: #fff;
    color: #cf1322;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.cehua-po-history-clear-btn:hover {
    background: #fff2f0;
}

/* ── 历史记录面板 ── */
.cehua-plan-outline-history-pane {
    animation: cehua-po-pane-fadein 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 200px;
    max-height: min(85vh, 900px);
    padding: 12px 14px 14px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--border-color, #e5e6eb);
    border-radius: 10px;
    overflow: hidden;
}
.cehua-plan-outline-history-pane[hidden] {
    display: none !important;
}

.cehua-po-history-list {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cehua-po-history-empty {
    padding: 24px 0;
    text-align: center;
    color: #86909c;
    font-size: 13px;
}

.cehua-po-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e5e6eb;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.cehua-po-history-item:hover {
    background: #f0f5ff;
    border-color: #adc6ff;
}

.cehua-po-history-item-info {
    flex: 1;
    min-width: 0;
}
.cehua-po-history-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #1d2129;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cehua-po-history-item-meta {
    font-size: 12px;
    color: #86909c;
    margin-top: 2px;
}

.cehua-po-history-item-del {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #86909c;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}
.cehua-po-history-item-del:hover {
    background: #fff2f0;
    color: #cf1322;
}

/* ── 历史态隐藏表单和结果 ── */
.cehua-plan-outline-shell--history .cehua-plan-outline-form-pane,
.cehua-plan-outline-shell--history .cehua-plan-outline-result-pane {
    display: none !important;
}
.cehua-plan-outline-shell--form .cehua-plan-outline-history-pane,
.cehua-plan-outline-shell--result .cehua-plan-outline-history-pane {
    display: none !important;
}
