/* Styles communs et page Formatage */
:root {
            --bg: #f6f7f9; --panel: #fff; --panel-alt: #f9fafb;
            --border: #dde1e6; --border-strong: #c0c7d0;
            --text: #1a1d21; --text-soft: #40474f; --muted: #6b7280;
            --accent: #0d6efd; --accent-strong: #0a58ca;
            --success: #198754; --error: #dc2626; --warning: #a16207;
            --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
            --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
        }
        * { box-sizing: border-box; }
        ::-webkit-scrollbar { width: 10px; height: 10px; }
        ::-webkit-scrollbar-track { background: var(--bg); }
        ::-webkit-scrollbar-thumb { background: var(--border-strong); border: 2px solid var(--bg); border-radius: 5px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--muted); }
        [hidden], .hidden { display: none !important; }
        html, body { height: 100%; margin: 0; }
        body { background: var(--bg); color: var(--text); font-family: var(--font); }
        .page-formatage.is-restoring > main { visibility: hidden; }
        button, input, select, textarea { font: inherit; }
        button { cursor: pointer; }
        .drop-screen { min-height: 100%; display: grid; place-items: start center; padding: 1rem 2rem 2rem; }
        .drop-card { width: min(44rem, 100%); text-align: center; }
        .home-logo { display: inline-block; line-height: 0; }
        .drop-card .home-logo { display: block; width: 128px; height: 128px; margin: 0 auto .55rem; }
        .drop-logo { display: block; width: 128px; height: 128px; margin: 0; object-fit: contain; }
        .drop-card h1 { margin: 0 0 .35rem; font-size: 1.35rem; }
        .drop-card > p { margin: 0 0 1.2rem; color: var(--muted); font-size: .82rem; }
        .drop-card > p.drop-intro { max-width: 34rem; margin: .65rem auto 1rem; color: var(--text); font-size: .8rem; line-height: 1.55; }
        .drop-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
        .drop-zone {
            display: flex; flex-direction: column; align-items: center; gap: .3rem;
            width: 100%; padding: 1.25rem 1.2rem;
            border: 2px dashed var(--border-strong); border-radius: 8px;
            background: var(--panel); color: var(--text); font-family: inherit;
            cursor: pointer; transition: border-color .15s, background .15s;
        }
        .drop-zone:hover, .drop-zone:focus-visible { border-color: var(--accent); outline: 0; }
        .drop-zone.is-over { border-color: var(--accent); background: #cfe2ff; }
        .drop-zone.has-file { border-style: solid; border-color: var(--success); }
        .drop-icon { color: var(--muted); font-size: 1.6rem; line-height: 1; }
        .drop-zone-title { font-size: .9rem; font-weight: 700; }
        .drop-zone-detail { color: var(--muted); font-size: .75rem; }
        .btn {
            display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
            min-height: 2.1rem; padding: .4rem .75rem; border: 1px solid var(--border);
            border-radius: 4px; background: var(--panel); color: var(--text); text-decoration: none;
        }
        .spinner { display:inline-block; width:1em; height:1em; margin-right:.4em; border:2px solid var(--border); border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite; vertical-align:-.15em; }
        .btn > .spinner { margin-right:0; }
        @keyframes spin { to { transform:rotate(360deg); } }
        .btn:hover { border-color: var(--border-strong); background: var(--panel-alt); }
        .btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
        .btn.primary:hover { background: var(--accent-strong); }
        .btn.danger { border-color: var(--error); background: var(--error); color: #fff; }
        .btn.danger:hover { background: #b91c1c; }
        .btn:disabled { opacity: .45; cursor: default; }
        .btn.inactive { opacity: .45; cursor: help; }
        .btn.icon-only { width: 2.1rem; padding: 0; }
        .drop-files { min-height: 1.2rem; margin-top: .45rem; color: var(--success); font-size: .78rem; font-weight: 600; overflow-wrap: anywhere; }
        .drop-error { color: var(--error); }
        .drop-card > p.drop-launch { margin: 1.75rem 0 0; }
        .drop-launch .btn { width: 4.5rem; min-height: 3.25rem; padding: 0; font-size: 1.25rem; }

        .app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
        .topbar {
            flex: 0 0 auto; display: flex; align-items: center; gap: .55rem;
            min-height: 3rem; padding: .45rem .75rem; border-bottom: 1px solid var(--border);
            background: var(--panel); font-size: .8rem;
        }
        .topbar-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
        #go-deposit { margin-left: .45rem; }
        .status { color: var(--muted); white-space: nowrap; }
        .status.error { color: var(--error); }
        .status.saved { color: var(--success); }
        .viewer { flex: 1 1 auto; display: grid; grid-template-columns: minmax(20rem, 38%) minmax(24rem, 1fr) 22rem; min-height: 0; }
        .pane { min-width: 0; min-height: 0; overflow: auto; background: var(--panel); }
        .pdf-pane { border-right: 1px solid var(--border); background: #525659; }
        .pdf-pane iframe { width: 100%; height: 100%; border: 0; display: block; }
        .md-pane { display: flex; flex-direction: column; padding: 1rem; }
        .md-pane.editing { padding: 0; }
        .pane-title { margin: 0 0 .55rem; color: var(--accent); font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; }
        .md-pane.editing > .pane-title { margin: 0; padding: 1rem 1rem .55rem; }
        .pane-title i { color: inherit; margin-right: .25rem; }
        #md-content { flex: 1 1 auto; overflow: auto; padding-right: .45rem; }
        #md-editor { flex: 1 1 auto; width: 100%; border: 0; resize: none; padding: 1.2rem 1.5rem; outline: 0; font-family: var(--mono); font-size: 13px; line-height: 1.55; font-variant-ligatures: none; }
        .editor-note { display:none; }
        .meta-pane { padding: 1rem 1rem 1.5rem; border-left: 1px solid var(--border); }
        .page-mark-help { margin: 0 0 .9rem; padding: .7rem .75rem; border: 0; border-radius: 6px; background: #faeea0; text-align: left; color: #554814; font-size: .7rem; line-height: 1.45; }
        .page-mark-help-title { display:flex; align-items:flex-start; gap:.55rem; }
        .page-mark-help-title > i { flex: 0 0 auto; margin-top: .15rem; color: #e0b72f; }
        .page-mark-help-body { min-width: 0; margin-top:.25rem; }
        .page-mark-help p { margin: 0; color: inherit; font-size: inherit; line-height: inherit; }
        .page-mark-help code { display: inline-block; margin: .15rem 0; padding: .05rem .35rem; border: 1px solid var(--border); border-radius: 4px; background: #eef1f4; color: #a3246e; font-family: var(--mono); font-size: .95em; line-height: 1.2; vertical-align: middle; overflow-wrap: anywhere; }
        .page-mark-help ul { margin: .25rem 0 0; padding-left: 1rem; color: inherit; font-size: inherit; line-height: inherit; }
        .page-mark-help li + li { margin-top: .15rem; }
        .meta-source-url { margin-bottom: .7rem; padding-bottom: .6rem; border-bottom: 1px dashed var(--border); }
        .meta-source-url-note { margin: .25rem 0 0; color: var(--muted); font-size: .7rem; line-height: 1.4; }
        .meta-fields-grid { display: grid; grid-template-columns: 1fr; gap: .6rem 1rem; }
        .meta-field { display: flex; flex-direction: column; gap: .2rem; }
        .meta-field-label { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-soft); font-size: .78rem; font-weight: 600; }
        .meta-field-source { display:inline-flex; align-items:center; justify-content:center; width:.8rem; height:.8rem; padding:0; border:1px solid transparent; border-radius:50%; font-size:.42rem; line-height:1; }
        .meta-field-source > i { transform:translateY(1px); }
        .meta-field-source.filled { color:#fff; background:var(--success); border-color:var(--success); box-shadow:0 0 0 2px rgb(25 135 84 / 12%); }
        .meta-field-source.empty { color:#fff; background:var(--error); border-color:var(--error); box-shadow:0 0 0 2px rgb(220 38 38 / 10%); }
        .meta-field input, .meta-field textarea, .meta-field select {
            width: 100%; padding: .3rem .45rem; border: 1px solid var(--border);
            border-radius: 4px; background: #fff; color: var(--text);
            font-family: inherit; font-size: .78rem; line-height: 1.35;
        }
        .meta-field textarea { min-height: 7.5rem; resize: vertical; }
        .meta-field input:focus, .meta-field textarea:focus, .meta-field select:focus { outline: 0; border-color: var(--accent); }
        .meta-ai-fields { margin-top: .8rem; padding: .7rem; border: 1px dashed var(--border-strong); border-radius: 4px; }
        .meta-ai-fields .llm-box { display: flex; align-items: center; gap: .55rem; margin: .7rem 0 0; padding: 0; border-top: 0; }
        .meta-ai-fields .llm-box .btn { width: 2.1rem; padding: 0; font-size: .78rem; }
        .meta-technical-fields { margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed var(--border); }
        .meta-technical-title { margin: 0 0 .6rem; color: var(--muted); font-family: var(--mono); font-size: .68rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
        .llm-box { margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--border); }
        .meta-hint { margin: .75rem 0 0; color: var(--muted); font-size: .7rem; }
        .viewer-md-fm {
            margin-bottom: .8rem; padding: .5rem .7rem;
            border: 1px solid var(--border); border-radius: 4px;
            background: var(--panel-alt); font-family: var(--font); font-size: .8rem;
        }
        .viewer-md-fm dl { display: grid; grid-template-columns: minmax(6rem, auto) 1fr; gap: .15rem .8rem; margin: 0; }
        .viewer-md-fm dl + dl { margin-top: .4rem; padding-top: .4rem; border-top: 1px dashed var(--border); }
        .viewer-md-fm dt { color: var(--text-soft); font-size: .7rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
        .viewer-md-fm dd { margin: 0; word-break: break-word; }
        .viewer-md-fm dl.fm-technical dt, .viewer-md-fm dl.fm-technical dd { color: var(--muted); font-size: .68rem; }
        .viewer-md-fm a { color: var(--accent); text-decoration: none; }
        .viewer-md-fm a:hover { text-decoration: underline; }
        .help-dialog { width: min(27rem, 90vw); padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
        .help-dialog::backdrop { background: rgb(17 24 39 / 30%); }
        .help-dialog-content { padding: 1rem 1.1rem 1.1rem; }
        .help-dialog h2 { margin: 0 0 .55rem; color: var(--accent); font-size: .9rem; }
        .help-dialog p { margin: 0 0 .9rem; color: var(--text-soft); font-size: .8rem; line-height: 1.5; }
        .help-dialog p.help-dialog-actions { margin: 0; text-align: right; }
        @media (max-width: 1100px) {
            .app { height: auto; min-height: 100%; overflow: visible; }
            .viewer { grid-template-columns: 1fr; }
            .pane { min-height: 32rem; }
            .meta-pane { min-height: auto; border-left: 0; border-top: 1px solid var(--border); }
            .topbar { flex-wrap: wrap; }
        }

/* Accueil */
body.page-home main { width:min(38rem,calc(100% - 2rem)); margin:0 auto; padding:1rem 0 3rem; text-align:center; }
.page-home .logo { display:block; width:128px; height:128px; margin:0 auto .55rem; object-fit:contain; }
.page-home h1 { margin:0 0 .35rem; font-size:1.35rem; }
.page-home .title-ampersand { color:#b5bac3; font-size:.68em; font-weight:400; }
.page-home .presentation { max-width:34rem; margin:.65rem auto 1rem; color:var(--text); font-size:.8rem; line-height:1.55; }
.page-home .inline-brand { display:inline-block; width:auto; height:12px; margin:0 .08rem; vertical-align:-1px; object-fit:contain; }
.page-home .inline-brand-link { display:inline-block; line-height:1; text-decoration:none; }
.page-home .intro { margin:0 0 1.5rem; color:var(--muted); font-size:.82rem; }
.page-home .choices { display:grid; grid-template-columns:1fr; gap:1rem; max-width:24rem; margin:0 auto; }
.page-home .choice { display:flex; flex-direction:column; align-items:center; gap:.45rem; padding:2rem 1.2rem; border:1px solid var(--border-strong); border-radius:8px; background:var(--panel); color:var(--text); text-decoration:none; }
.page-home .choice:hover,.page-home .choice:focus-visible { border-color:var(--accent); outline:0; }
.page-home .choice i { color:var(--accent); font-size:1.5rem; }
.page-home .choice .choice-icons { display:flex; align-items:center; justify-content:center; gap:1.25rem; margin-bottom:1.2rem; color:inherit; font-size:inherit; line-height:1; }
.page-home .choice strong { font-size:.92rem; }
.page-home .choice span { color:var(--muted); font-size:.74rem; line-height:1.45; }
@media(max-width:560px){ .page-home .choices{grid-template-columns:1fr;} }

/* Dépôt Git */
body.page-depot main { width:min(44rem,calc(100% - 2rem)); margin:0 auto; padding:1rem 0 3rem; text-align:center; }
.page-depot .home-logo { display:block; width:128px; height:128px; margin:0 auto .55rem; line-height:0; }
.page-depot .logo { display:block; width:128px; height:128px; margin:0; object-fit:contain; }
.page-depot h1 { margin:0 0 .35rem; font-size:1.35rem; }
.page-depot .intro { max-width:34rem; margin:.65rem auto 1rem; color:var(--text); font-size:.8rem; line-height:1.55; }
.page-depot .inline-brand { display:inline-block; width:auto; height:12px; margin:0 .08rem; vertical-align:-1px; object-fit:contain; }
.page-depot .inline-brand-link { display:inline-block; line-height:1; text-decoration:none; }
.page-depot .zones { display:grid; gap:1rem; }
.page-depot .zone { display:flex; flex-direction:column; align-items:center; gap:.3rem; width:100%; padding:1.25rem 1.2rem; border:2px dashed var(--border-strong); border-radius:8px; background:var(--panel); color:var(--text); font:inherit; }
.page-depot .zone.has-file { border-style:solid; border-color:var(--success); }
.page-depot .zone i { color:var(--muted); font-size:1.6rem; }
.page-depot .zone .drop-zone-title { color:var(--text); font-size:.9rem; font-weight:700; }
.page-depot .zone .drop-zone-detail { color:var(--muted); font-size:.75rem; }
.page-depot .zone .filename { min-height:1.1rem; color:var(--success); font-weight:600; }
.page-depot .action { margin:1.5rem 0 0; }
.page-depot .btn { width:4.5rem; min-height:3.1rem; border:1px solid var(--accent); border-radius:4px; background:var(--accent); color:#fff; font-size:1.1rem; }
.page-depot .btn:disabled { opacity:.4; cursor:default; }
.page-depot .notice { margin:1rem 0 0; color:var(--muted); font-size:.72rem; }
.page-depot .notice:empty { display:none; }
.page-depot .notice a { color:var(--accent); font-weight:600; }
.page-depot .deposit-success-actions { display:flex; align-items:stretch; justify-content:center; gap:1rem; margin:2rem auto 0; }
.page-depot .deposit-success-actions[hidden] { display:none; }
.page-depot .success-action { display:inline-flex; flex-direction:column; align-items:center; justify-content:center; gap:.5rem; width:12.5rem; height:4.5rem; padding:.75rem 1rem; border:1px solid var(--border-strong); border-radius:7px; background:var(--panel); color:var(--text); font-size:.75rem; font-weight:600; line-height:1.2; text-decoration:none; }
.page-depot .success-action i { font-size:1.2rem; }
.page-depot .success-action.home i { color:var(--accent); }
.page-depot .success-action:hover,.page-depot .success-action:focus-visible { border-color:var(--accent); outline:0; }
.page-depot .success-action.merge-request { border-color:var(--accent); background:var(--accent); color:#fff; }
.page-depot .success-action.merge-request:hover,.page-depot .success-action.merge-request:focus-visible { background:var(--accent-strong); }
.page-depot .success-action.merge-request { transform:scale(.98); }
.page-depot.deposit-complete h1,
.page-depot.deposit-complete .intro,
.page-depot.deposit-complete .zones,
.page-depot.deposit-complete .action,
.page-depot.deposit-complete .notice { display:none; }
@media(max-width:560px){ .page-depot .deposit-success-actions{flex-direction:column;} }
