/* ===== WIKI TOOLBAR ===== */
.wiki-toolbar {
    background: #fff;
    padding-bottom: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    align-items: center;
    margin: -2rem -1rem 2rem -1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.wiki-btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: none; border: 1px solid #a2a9b1; border-radius: 3px;
    padding: 0.3rem 0.8rem; font-size: 0.82rem; cursor: pointer;
    color: #555; font-family: inherit; transition: background 0.15s;
}
.wiki-btn:hover { background: #eaecf0; }
.wiki-btn.primary { background: #007bff; color: #fff; border-color: #007bff; }
.wiki-btn.primary:hover { background: #0069d9; }

/* ===== FULL-PAGE EDITOR OVERLAY ===== */
.editor-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #f8f9fa;
    z-index: 500;
    overflow-y: auto;
    margin-top: 50px;
}
.editor-overlay.visible { display: block; }


.editor-topbar {
    background: #fff;
    border-bottom: 2px solid #007bff;
    padding: 0.6rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}
.editor-topbar-title { font-weight: 700; font-size: 1rem; color: #333; }
.editor-topbar-actions { display: flex; gap: 0.5rem; }

.editor-body { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem; }

.section-editor-block {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.section-editor-block-header {
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    user-select: none;
}
.section-editor-block-header:active { cursor: grabbing; }
.section-type-badge { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #666; display: flex; align-items: center; gap: 0.4rem; }
.section-actions { display: flex; gap: 0.4rem; }
.sec-btn { background: none; border: 1px solid #ccc; border-radius: 3px; padding: 0.15rem 0.5rem; font-size: 0.75rem; cursor: pointer; color: #555; font-family: inherit; }
.sec-btn:hover { background: #f0f0f0; }
.sec-btn.danger { border-color: #f87171; color: #dc2626; }
.sec-btn.danger:hover { background: #fef2f2; }

.section-editor-block-body { padding: 1rem; }

.ef { margin-bottom: 0.85rem; }
.ef label { display: block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #888; margin-bottom: 0.25rem; }
.ef input, .ef textarea, .ef select { width: 100%; padding: 0.4rem 0.6rem; border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.88rem; font-family: inherit; box-sizing: border-box; outline: none; }
.ef input:focus, .ef textarea:focus { border-color: #007bff; box-shadow: 0 0 0 2px rgba(0,123,255,0.12); }
.ef textarea { resize: vertical; min-height: 72px; }

.cmd-row { display: grid; grid-template-columns: 160px 1fr 2fr 24px; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }
.cmd-row input { font-size: 0.82rem; }
.cmd-row-del { background: none; border: none; color: #dc2626; cursor: pointer; font-size: 1rem; padding: 0; line-height: 1; }

.add-cmd-btn { background: none; border: 1px dashed #007bff; color: #007bff; border-radius: 4px; padding: 0.3rem 0.8rem; font-size: 0.82rem; cursor: pointer; font-family: inherit; margin-top: 0.25rem; }

.add-section-bar { border: 2px dashed #cbd5e1; border-radius: 6px; padding: 1rem; text-align: center; margin-bottom: 1.5rem; }
.add-section-bar p { font-size: 0.85rem; color: #888; margin-bottom: 0.75rem; }
.add-section-types { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.add-type-btn { background: #fff; border: 1px solid #a2a9b1; border-radius: 4px; padding: 0.35rem 0.9rem; font-size: 0.82rem; cursor: pointer; font-family: inherit; color: #333; transition: all 0.15s; }
.add-type-btn:hover { background: #007bff; color: #fff; border-color: #007bff; }

/* History panel */
.history-panel { display: none; position: fixed; top: 0; right: 0; bottom: 0; width: 320px; background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,0.12); z-index: 600; flex-direction: column; }
.history-panel.visible { display: flex; }
.history-header { padding: 1rem; border-bottom: 1px solid #e0e0e0; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.history-close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #888; }
.history-body { overflow-y: auto; flex: 1; padding: 1rem; }
.history-entry { border: 1px solid #e5e7eb; border-radius: 4px; padding: 0.65rem; margin-bottom: 0.65rem; }
.history-date { font-size: 0.72rem; color: #9ca3af; margin-bottom: 0.3rem; }
.btn-restore { font-size: 0.75rem; color: #007bff; background: none; border: 1px solid #93c5fd; border-radius: 3px; padding: 0.15rem 0.5rem; cursor: pointer; margin-top: 0.3rem; display: block; }

.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 0.55rem 1.4rem; border-radius: 6px; font-size: 0.88rem; z-index: 2000; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.toast.show { opacity: 1; }
