/* Storyteller — intelligent manuscript editing (ImportMaterial panel shell) */

.chapter-replace-panel {
    width: min(720px, 100%);
}

.chapter-replace-panel.is-history-workspace {
    width: min(920px, 100%);
    max-height: min(88vh, 900px);
    padding: 28px 30px 32px;
}

.chapter-replace-history-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px 20px;
    margin: 0 0 18px;
    padding: 14px 16px;
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 12px;
}

.chapter-replace-history-chapter {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #444;
}

.chapter-replace-history-chapter select {
    min-height: 38px;
    min-width: 220px;
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 14px;
    color: #111;
}

.chapter-replace-history-count {
    margin: 0;
    font-size: 13px;
    color: #888;
}

.chapter-replace-history-empty {
    margin-top: 12px;
}

.chapter-replace-panel.is-history-workspace .chapter-replace-draft-list {
    gap: 10px;
    margin-bottom: 22px;
}

.chapter-replace-panel.is-history-workspace .chapter-replace-draft-btn {
    padding: 16px 18px;
    min-height: 64px;
}

.chapter-replace-observations {
    margin: 0 0 18px;
    padding-left: 1.2em;
    font-size: 15px;
    line-height: 1.55;
    color: #333;
}

.chapter-replace-observations li {
    margin-bottom: 0.45em;
}

.chapter-replace-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.chapter-replace-chip {
    border: 1px solid #e0e0e0;
    background: #f7f7f7;
    border-radius: 999px;
    padding: 8px 12px;
    font: inherit;
    font-size: 13px;
    line-height: 1.35;
    color: #333;
    cursor: pointer;
    text-align: left;
}

.chapter-replace-chip:hover {
    background: #efefef;
    border-color: #ccc;
}

.chapter-replace-instructions {
    margin-bottom: 14px;
}

.chapter-replace-ask {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #fafafa;
    border-radius: 12px;
}

.chapter-replace-ask p {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.5;
}

.chapter-replace-summary {
    margin: 0 0 20px;
    padding: 16px 18px;
    background: #fafafa;
    border-radius: 12px;
}

.chapter-replace-summary h3 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 500;
}

.chapter-replace-summary p {
    margin: 10px 0 4px;
    font-size: 14px;
}

.chapter-replace-summary ul {
    margin: 0 0 8px;
    padding-left: 1.2em;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.chapter-replace-draft-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.chapter-replace-draft-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.chapter-replace-draft-btn {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    flex: 1;
    text-align: left;
    padding: 14px 16px;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    background: #fafafa;
    cursor: pointer;
    font: inherit;
    color: #111;
}

.chapter-replace-draft-btn:hover {
    background: #f3f3f3;
    border-color: #d8d8d8;
}

.chapter-replace-draft-row.is-active .chapter-replace-draft-btn {
    border-color: #111;
    background: #fff;
}

.chapter-replace-delete-btn {
    color: #5c2b2b;
}

.chapter-replace-delete-btn:disabled {
    color: #999;
    opacity: 0.7;
    cursor: not-allowed;
}

.chapter-replace-draft-btn strong {
    font-weight: 500;
}

.chapter-replace-draft-btn span {
    font-size: 13px;
    color: #777;
}

.chapter-replace-active {
    margin-left: auto;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #111;
}

.chapter-replace-compare-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.chapter-replace-compare-controls label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #666;
}

.chapter-replace-compare-controls select,
.chapter-replace-compare-controls input {
    font: inherit;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-width: 140px;
}

.chapter-replace-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

@media (max-width: 720px) {
    .chapter-replace-compare-grid {
        grid-template-columns: 1fr;
    }
}

.chapter-replace-compare-pane {
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    max-height: 42vh;
    overflow: auto;
}

.chapter-replace-compare-pane h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 500;
}

.chapter-replace-compare-pane pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    color: #222;
}
