@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg: #14181c;
    --surface: #1a2025;
    --surface-2: #20272d;
    --border: #2b333b;
    --text: #dde3e8;
    --muted: #7d8994;
    --accent: #e8a33d;
    --accent-dim: #4a3a22;
    --green: #7ec699;
    --red: #d9707a;
    --radius: 4px;
    --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
    --sans: 'IBM Plex Sans', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* -------- Sidebar -------- */

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.brand {
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.brand .prompt { color: var(--accent); }

.search-form input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 7px 10px;
    font-family: var(--mono);
    font-size: 13px;
}
.search-form input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.tree {
    font-family: var(--mono);
    font-size: 13px;
    flex: 1;
    overflow-y: auto;
}
.tree ul {
    list-style: none;
    margin: 0;
    padding-left: 14px;
    border-left: 1px dashed var(--border);
}
.tree > ul { padding-left: 0; border-left: none; }
.tree li { margin: 2px 0; }
.tree a {
    color: var(--muted);
    display: inline-block;
    padding: 2px 4px;
    border-radius: 3px;
}
.tree a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.tree a.active { color: var(--bg); background: var(--accent); }
.tree .glyph { color: var(--border); margin-right: 2px; }
.tree .ns-node.dragging { opacity: .4; }
.tree .ns-node.drag-over, #ns-root-drop.drag-over {
    background: var(--accent-dim) !important;
    color: var(--accent) !important;
    outline: 1px dashed var(--accent);
}
.article-drag { cursor: grab; }
.article-drag.dragging { opacity: .4; }
.drag-handle {
    display: inline-block;
    color: var(--border);
    margin-right: 6px;
    cursor: grab;
    font-size: 12px;
    user-select: none;
}
.drag-handle:hover { color: var(--accent); }
.article-drag.drop-above { box-shadow: inset 0 2px 0 0 var(--accent); }
.article-drag.drop-below { box-shadow: inset 0 -2px 0 0 var(--accent); }
.ns-card.drag-over {
    border-color: var(--accent) !important;
    background: var(--accent-dim) !important;
    outline: 1px dashed var(--accent);
}

.tree li { display: flex; flex-wrap: wrap; align-items: center; }
.tree-toggle {
    flex: 0 0 14px;
    width: 14px;
    text-align: center;
    color: var(--border);
    cursor: pointer;
    user-select: none;
    font-size: 9px;
    transition: transform .12s ease;
    display: inline-block;
}
.tree-toggle:hover { color: var(--accent); }
.tree-toggle.expanded { transform: rotate(90deg); }
.tree-toggle-empty { cursor: default; }
.tree-children {
    flex-basis: 100%;
    margin-left: 14px;
}
.tree-children.collapsed { display: none; }
.tree-articles {
    list-style: none;
    margin: 0;
    padding-left: 14px;
    border-left: 1px dashed var(--border);
}
.tree-root-articles { padding-left: 0; border-left: none; margin-top: 2px; }
.tree-article-link {
    color: var(--muted);
    font-size: 12.5px;
    display: inline-block;
    padding: 2px 4px;
    border-radius: 3px;
}
.tree-article-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

.sidebar-footer {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-links {
    font-family: var(--mono);
    font-size: 11.5px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.sidebar-links a { color: var(--muted); }
.sidebar-links a:hover { color: var(--accent); }
.group-switcher select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 7px 8px;
    font-family: var(--mono);
    font-size: 12.5px;
}

/* -------- Main -------- */

.main { padding: 28px 40px 60px; max-width: 900px; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 22px;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #1a1300;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.topbar-username {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}
.role-badge {
    font-family: var(--mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 3px 9px;
    border-radius: 20px;
    border: 1px solid transparent;
}
.role-badge.role-reader { background: #23282d; color: var(--muted); border-color: var(--border); }
.role-badge.role-writer { background: #16261d; color: var(--green); border-color: #234a34; }
.role-badge.role-admin { background: #362507; color: var(--accent); border-color: #5a3f12; }

.topbar-links { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--sans);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 13px 6px 10px;
    transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.topbar-pill:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
    text-decoration: none;
}
.topbar-pill svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 1.4;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}
.topbar-pill-quit:hover { color: var(--red); border-color: var(--red); background: #3a1c1e; }

@media (max-width: 900px) {
    .topbar { flex-direction: column; align-items: flex-start; }
}

.breadcrumb {
    font-family: var(--mono);
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: baseline;
    gap: 2px;
}
.breadcrumb .user { color: var(--green); }
.breadcrumb .sep { color: var(--border); margin: 0 2px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .cursor {
    display: inline-block;
    width: 8px; height: 16px;
    background: var(--accent);
    margin-left: 4px;
    animation: blink 1.1s step-end infinite;
}
@media (prefers-reduced-motion: reduce) { .breadcrumb .cursor { animation: none; } }
@keyframes blink { 50% { opacity: 0; } }

h1 { font-size: 24px; font-weight: 600; margin: 0 0 6px; }
h2 { font-size: 18px; font-weight: 600; color: var(--text); margin-top: 32px; }

.meta { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.actions { display: flex; gap: 10px; margin-bottom: 24px; }

.btn {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a1300; font-weight: 600; }
.btn-primary:hover { color: #1a1300; opacity: .9; }
.btn-danger:hover { border-color: var(--red); color: var(--red); }

.card-list { list-style: none; padding: 0; margin: 0; }
.card-list li {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
}
.card-list a { color: var(--text); font-weight: 500; }
.card-list .ts { color: var(--muted); font-size: 12px; font-family: var(--mono); }

.ns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 28px; }
.ns-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--surface);
    font-family: var(--mono);
    color: var(--text);
    display: block;
}
.ns-card:hover { border-color: var(--accent); text-decoration: none; }
.ns-card .glyph { color: var(--accent); margin-right: 6px; }

.empty { color: var(--muted); font-style: italic; padding: 24px 0; }

/* article content */
.article-content { font-size: 15px; }
.article-content h1, .article-content h2, .article-content h3 { margin-top: 28px; }
.article-content pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 13px;
}
.article-content code {
    font-family: var(--mono);
    background: var(--surface-2);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 13px;
}
.article-content pre code { background: none; padding: 0; }
.article-content img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.article-content table { border-collapse: collapse; }
.article-content table:not([width]) { width: 100%; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 6px 10px; font-size: 13px; }

/* forms */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.form-row input[type=text] {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 9px 12px;
    font-family: var(--mono);
    font-size: 14px;
}
.form-row input[type=text]:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: var(--mono); }
.form-hint .ok { color: var(--green); }
.form-hint .new { color: var(--accent); }
.inline-btn {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #1a1300;
    font-weight: 600;
    border-radius: 3px;
    padding: 3px 9px;
    font-size: 11.5px;
    font-family: var(--sans);
    cursor: pointer;
}
.inline-btn:hover { opacity: .85; }
.inline-select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 11.5px;
    font-family: var(--mono);
}

.editor-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
#content {
    width: 100%;
    min-height: 420px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 14px;
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.6;
    resize: vertical;
}
.preview-pane {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--surface);
    overflow-y: auto;
    max-height: 500px;
}

/* -------- Traitement de texte (barre d'outils + page) -------- */

.doc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    z-index: 5;
}
.tbgroup {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 10px;
    border-right: 1px solid var(--border);
}
.tbgroup:last-child { border-right: none; }
.doc-toolbar button {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 3px;
    padding: 5px 9px;
    font-size: 12.5px;
    font-family: var(--sans);
    cursor: pointer;
    line-height: 1.2;
    min-width: 30px;
}
.doc-toolbar button:hover { border-color: var(--accent); color: var(--accent); }
.doc-toolbar select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 3px;
    padding: 5px 6px;
    font-size: 12.5px;
    font-family: var(--sans);
}
.color-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 28px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}
.color-btn input[type=color] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.toolbar-color-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 32px;
    padding: 4px 0 3px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.toolbar-color-btn:hover { border-color: var(--accent); }
.color-swatch {
    width: 18px;
    height: 4px;
    border-radius: 2px;
    background: var(--accent);
    display: block;
}
#highlight-color-swatch { background: var(--accent); }

.color-popover {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    z-index: 20;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(0,0,0,.4);
    padding: 10px;
    display: none;
    width: 232px;
}
.color-popover.show { display: block; }
.color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    margin-bottom: 8px;
}
.color-swatch-btn {
    width: 30px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
}
.color-swatch-btn:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.color-popover-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}
.color-popover-row input[type=color] {
    width: 30px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: none;
    cursor: pointer;
}
.save-indicator {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted);
    border-right: none;
    padding-right: 0;
    white-space: nowrap;
}
.save-indicator.saved { color: var(--green); }
.toolbar-end { display: flex; gap: 6px; align-items: center; }
.toolbar-end .btn { padding: 6px 12px; }

.doc-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 6px;
}
.doc-meta-row input[type=text] {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 9px 12px;
    font-family: var(--mono);
    font-size: 14px;
}
.doc-meta-row input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.doc-page {
    background: #f6f3ec;
    color: #23201a;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 48px;
    min-height: 560px;
    max-width: 820px;
    margin: 14px auto 0;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 15px;
    line-height: 1.65;
    box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.doc-page:focus { outline: none; }
.doc-page h1, .doc-page h2, .doc-page h3 { margin-top: 0.6em; }
.doc-page pre {
    background: #e8e3d6;
    border-radius: 3px;
    padding: 10px 12px;
    font-family: var(--mono);
    font-size: 13px;
    overflow-x: auto;
}
.doc-page code { font-family: var(--mono); }
.doc-page img { max-width: 100%; border-radius: 3px; margin: 8px 0; cursor: pointer; }

.img-resize-overlay {
    position: fixed;
    z-index: 60;
    pointer-events: none;
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    display: none;
}
.img-resize-overlay.show { display: block; }
.img-resize-handle {
    position: absolute;
    width: 11px;
    height: 11px;
    background: var(--accent);
    border: 1px solid #1a1300;
    border-radius: 2px;
    pointer-events: all;
}
.handle-tl { top: -6px; left: -6px; cursor: nwse-resize; }
.handle-tr { top: -6px; right: -6px; cursor: nesw-resize; }
.handle-bl { bottom: -6px; left: -6px; cursor: nesw-resize; }
.handle-br { bottom: -6px; right: -6px; cursor: nwse-resize; }
.doc-page table { border-collapse: collapse; }
.doc-page td, .doc-page th { border: 1px solid #cfc9b8; padding: 6px 10px; }
.doc-page blockquote { border-left: 3px solid var(--accent); margin: 0; padding-left: 14px; color: #5a5442; }
.doc-page a { color: #9a5a1f; }
.doc-page a.wiki-link, .article-content a.wiki-link {
    color: inherit;
    border-bottom: 1px dashed currentColor;
    text-decoration: none;
    padding-bottom: 1px;
}
.doc-page a.wiki-link::before, .article-content a.wiki-link::before {
    content: "» ";
    opacity: .6;
}
.article-content a.wiki-link { color: var(--accent); }

/* -------- Popover de sélection d'article (lien interne) -------- */
.link-popover {
    position: absolute;
    z-index: 20;
    width: 320px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(0,0,0,.4);
    padding: 10px;
    display: none;
}
.link-popover.show { display: block; }
.link-popover input[type=text] {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text);
    padding: 7px 9px;
    font-family: var(--mono);
    font-size: 12.5px;
    margin-bottom: 8px;
}
.link-popover input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.link-popover-results { max-height: 220px; overflow-y: auto; }
.link-popover-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-radius: 3px;
    padding: 7px 8px;
    cursor: pointer;
    color: var(--text);
    font-family: var(--sans);
    font-size: 12.5px;
}
.link-popover-item:hover { background: var(--surface-2); }
.link-popover-item .ns { display: block; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.link-popover-empty { color: var(--muted); font-size: 12px; padding: 8px 4px; font-family: var(--mono); }
.type-tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}
.type-tag.type-article { background: var(--accent-dim); color: var(--accent); }
.type-tag.type-script { background: #1e3a3a; color: var(--green); }
.type-tag.type-ns { background: #2a3a4a; color: #6ba3d6; }

/* -------- Scripts -------- */
.script-filters { display: flex; gap: 10px; margin: 16px 0 20px; flex-wrap: wrap; }
.script-filters input[type=text] {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-family: var(--mono);
    font-size: 13px;
    flex: 1;
    min-width: 180px;
}
.script-filters select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-family: var(--mono);
    font-size: 13px;
}
.script-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.script-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
}
.script-table td { border-bottom: 1px solid var(--border); padding: 9px 10px; }
.script-table td.mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.script-table tr:hover td { background: var(--surface); }

.code-block {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre;
}
.code-editor {
    width: 100%;
    min-height: 420px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 16px 18px;
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.6;
    resize: vertical;
    tab-size: 4;
}
.code-editor:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.doc-page a.wiki-link-script, .article-content a.wiki-link-script {
    color: var(--green);
    border-bottom: 1px dashed currentColor;
    text-decoration: none;
    padding-bottom: 1px;
}
.doc-page a.wiki-link-script::before, .article-content a.wiki-link-script::before {
    content: "⌘ ";
    opacity: .7;
}

.hierarchy-path {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 14px;
}
.hierarchy-path a { color: var(--muted); }
.hierarchy-path a:hover { color: var(--accent); }
.hierarchy-path .sep { color: var(--border); }

.inline-form {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.inline-form form { display: flex; gap: 8px; }
.inline-form input[type=text] {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text);
    padding: 8px 10px;
    font-family: var(--mono);
    font-size: 13px;
}
.parent-picker { margin-top: 10px; }

.btn-move {
    font-size: 11px;
    padding: 3px 9px;
    margin-left: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 3px;
    cursor: pointer;
}
.btn-move:hover { color: var(--accent); border-color: var(--accent); }
#move-popover { width: 260px; }

.article-tree ul {
    list-style: none;
    margin: 0;
    padding-left: 18px;
    border-left: 1px dashed var(--border);
}
.article-tree > ul { padding-left: 0; border-left: none; }
.article-tree li { margin: 6px 0; }
.article-tree a { font-family: var(--sans); font-weight: 500; }

@media (max-width: 800px) {
    .doc-page { padding: 24px; }
    .doc-meta-row { grid-template-columns: 1fr; }
}
.paste-zone {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 10px;
}
.paste-zone.dragover { border-color: var(--accent); color: var(--accent); }
.ocr-panel {
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: 10px 14px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    display: none;
}
.ocr-panel.show { display: block; }
.ocr-panel pre { white-space: pre-wrap; margin: 6px 0 0; color: var(--text); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; font-family: var(--mono); }
.flash.error { background: #3a1c1e; color: var(--red); border: 1px solid #5a2b2e; }
.flash.success { background: #1c3a29; color: var(--green); border: 1px solid #2b5a3e; }

.auth-box {
    max-width: 360px;
    margin: 10vh auto;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.auth-box h1 { font-family: var(--mono); font-size: 18px; }
.auth-box form { margin-top: 20px; }
.auth-box .btn-primary { width: 100%; margin-top: 6px; text-align: center; }

.simple-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.simple-topbar nav { display: flex; align-items: center; gap: 16px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.simple-topbar nav a { color: var(--muted); }
.simple-topbar nav a:hover { color: var(--accent); }
.simple-main { max-width: 720px; margin: 0 auto; padding: 32px 24px 60px; }

@media (max-width: 800px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .editor-wrap { grid-template-columns: 1fr; }
}

/* -------- Page d'aide -------- */
.help-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 16px 0 28px;
    font-family: var(--mono);
    font-size: 12.5px;
}
.help-toc a { color: var(--muted); }
.help-toc a:hover { color: var(--accent); }
.help-section { margin-bottom: 32px; scroll-margin-top: 16px; }
.help-section h2 {
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-top: 0;
}
.help-section ul { padding-left: 20px; margin: 10px 0; }
.help-section li { margin-bottom: 8px; line-height: 1.6; }
.help-section code {
    font-family: var(--mono);
    background: var(--surface-2);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 13px;
}

/* -------- Panneau de présentation sur la page de connexion -------- */
/* Le conteneur générique .simple-main limite tout à 720px de large ;
   on lève cette limite spécifiquement pour la page de connexion, et on
   centre verticalement dans l'espace restant sous la barre du haut. */
.simple-main:has(> .login-layout) {
    max-width: none;
    padding: 0;
    min-height: calc(100vh - 62px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 64px;
    max-width: 1400px;
    width: 96vw;
    margin: 0 auto;
    padding: 24px;
}
.login-intro { flex: 1 1 700px; max-width: 900px; min-width: 0; }
.login-intro h1 {
    font-family: var(--mono);
    font-size: 26px;
    margin: 0 0 4px;
    color: var(--text);
}
.login-intro .tagline {
    color: var(--accent);
    font-size: 14px;
    font-family: var(--mono);
    margin-bottom: 18px;
}
.login-intro p { color: var(--muted); line-height: 1.6; font-size: 14px; }
.login-intro ul { list-style: none; padding: 0; margin: 20px 0 0; }
.login-intro li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 13.5px;
    line-height: 1.5;
}
.login-intro li .icon {
    flex-shrink: 0;
    width: 26px; height: 26px;
    border-radius: 6px;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}
.login-layout .auth-box { margin: 0; flex-shrink: 0; }
@media (max-width: 760px) {
    .simple-main:has(> .login-layout) { min-height: 0; display: block; }
    .login-layout { margin-top: 4vh; flex-direction: column; }
    .login-intro { text-align: left; max-width: 100%; }
}
