
:root {
  --mc-bg: #EDF2F7; --mc-surface: #FFFFFF; --mc-border: #E1E8F0;
  --mc-text: #33414F; --mc-ink: #17222F; --mc-muted: #6B7A8B;
  --mc-primary: #2C82D0; --mc-primary-600: #1F66AC; --mc-soft: #F6F9FC; --mc-soft-line: #DCE7F2;
  --mc-green: #1E9E76; --mc-green-bg: #E4F5EF;
  --mc-red: #D65C54; --mc-red-bg: #FBEBEA;
  --mc-alert: #8A55D1; --mc-alert-strong: #6E3DB4; --mc-alert-bg: #E7DDF7; --mc-alert-sub: #8A6BB0;
  --mc-code-bg: #D7E9FB; --mc-ranged: #184F84; --mc-ranged-bg: #EDF5FD;
  --mc-radius: 10px;
  --mc-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mc-mono: 'JetBrains Mono', 'SF Mono', Menlo, Monaco, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--mc-font); font-size: 15px; line-height: 1.6; color: var(--mc-text); background: var(--mc-bg); font-feature-settings: "tnum"; -webkit-font-smoothing: antialiased; }
a { color: var(--mc-primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, code { font-family: var(--mc-mono); font-feature-settings: "tnum"; }
svg.ic { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.draft-banner { display: flex; align-items: center; justify-content: center; gap: 7px; background: var(--mc-alert-bg); color: var(--mc-alert-strong); padding: 8px 20px; text-align: center; font-size: 13px; border-bottom: 1px solid #D9C4EF; }
.draft-banner svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.layout { display: grid; grid-template-columns: 280px 1fr 340px; min-height: 100vh; }
/* Éléments mobiles — masqués en desktop, activés sous 1100px */
.mobile-topbar, .drawer-overlay, .drawer-close { display: none; }
@media (max-width: 1240px) { .layout { grid-template-columns: 250px 1fr 300px; } }

/* Sidebar gauche : navigation + recherche (conservée) */
.sidebar-left { background: var(--mc-surface); border-right: 1px solid var(--mc-border); overflow-y: auto; height: 100vh; position: sticky; top: 0; padding: 18px 0; }
.sidebar-left .brand { display: flex; gap: 10px; align-items: center; padding: 0 18px 14px; border-bottom: 1px solid var(--mc-border); }
.sidebar-left .brand img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.sidebar-left .brand h1 { font-size: 16px; margin: 0; color: var(--mc-ink); line-height: 1.2; }
.sidebar-left .brand .sub { font-size: 11px; color: var(--mc-muted); }
.sidebar-left .ver { padding: 8px 18px 2px; font-size: 11px; color: var(--mc-muted); font-family: var(--mc-mono); }
.sidebar-left .ver b { color: var(--mc-text); font-weight: 600; }
.sidebar-left .search { padding: 12px 16px; }
.sidebar-left .search .box { display: flex; align-items: center; gap: 8px; border: 1px solid var(--mc-border); border-radius: var(--mc-radius); padding: 7px 10px; background: var(--mc-surface); }
.sidebar-left .search .box:focus-within { border-color: var(--mc-primary); box-shadow: 0 0 0 3px rgba(44,130,208,0.12); }
.sidebar-left .search .box svg { color: var(--mc-muted); }
.sidebar-left .search input { border: 0; outline: 0; width: 100%; font-size: 13px; font-family: inherit; background: transparent; color: var(--mc-text); }
.sidebar-left nav { padding: 4px 8px; }
.sidebar-left .group { margin-bottom: 4px; }
.sidebar-left .group-title { display: block; padding: 8px 12px; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--mc-muted); cursor: pointer; user-select: none; }
.sidebar-left .group-title:hover { background: var(--mc-bg); border-radius: 6px; }
.sidebar-left .group ul { list-style: none; margin: 0; padding: 0 0 4px 0; }
.sidebar-left .group li a { display: block; padding: 5px 12px 5px 24px; font-size: 13px; color: var(--mc-text); border-radius: 6px; }
.sidebar-left .group li a:hover { background: var(--mc-bg); text-decoration: none; }
.sidebar-left .group li a.active { background: #E4EFF9; color: var(--mc-primary-600); font-weight: 600; }

/* Contenu central */
main { padding: 28px 40px; max-width: 900px; }
main h1 { font-size: 27px; margin: 0 0 8px; color: var(--mc-ink); }
main .meta-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--mc-border); font-size: 12px; color: var(--mc-muted); }
main .meta-bar .badge { background: var(--mc-bg); color: var(--mc-muted); padding: 3px 9px; border-radius: 99px; font-family: var(--mc-mono); }
main .meta-bar .badge.type-marchand { background: var(--mc-code-bg); color: var(--mc-primary-600); }
main .meta-bar .badge.type-compte { background: var(--mc-code-bg); color: var(--mc-primary-600); }
main .meta-bar .badge.type-cas-frontiere { background: var(--mc-alert-bg); color: var(--mc-alert-strong); }
main .meta-bar .badge.type-anti-pattern { background: var(--mc-red-bg); color: var(--mc-red); }
main .meta-bar .badge.type-fondamental { background: var(--mc-green-bg); color: var(--mc-green); }
main .meta-bar .badge.type-procedure { background: var(--mc-ranged-bg); color: var(--mc-ranged); }
main .meta-bar .badge.status-draft { background: var(--mc-alert-bg); color: var(--mc-alert-strong); }
main .meta-bar .badge.status-active { background: var(--mc-green-bg); color: var(--mc-green); }
main h2 { font-size: 20px; margin: 30px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--mc-border); color: var(--mc-ink); }
main h3 { font-size: 16px; margin: 22px 0 8px; color: var(--mc-ink); }
main p { margin: 0 0 14px; }
main ul, main ol { margin: 0 0 14px 0; padding-left: 24px; }
main li { margin-bottom: 4px; }
main code { background: var(--mc-bg); padding: 1px 5px; border-radius: 4px; font-size: 13px; color: var(--mc-primary-600); }
main pre { background: var(--mc-ink); color: #E2E8F0; padding: 14px 18px; border-radius: var(--mc-radius); overflow-x: auto; margin: 0 0 16px; }
main pre code { background: none; color: inherit; padding: 0; font-size: 13px; }
main blockquote { border-left: 3px solid var(--mc-primary); background: var(--mc-soft); padding: 10px 18px; margin: 0 0 16px; color: var(--mc-primary-600); border-radius: 0 var(--mc-radius) var(--mc-radius) 0; }
main table { border-collapse: collapse; width: 100%; margin: 0 0 16px; font-size: 14px; }
main table th, main table td { padding: 8px 12px; border: 1px solid var(--mc-border); text-align: left; vertical-align: top; }
main table th { background: var(--mc-bg); font-weight: 600; color: var(--mc-ink); }
main a.wiki-link { background: var(--mc-code-bg); color: var(--mc-primary-600); padding: 1px 6px; border-radius: 4px; font-size: 0.95em; }
main a.wiki-link:hover { background: #C4DCF3; text-decoration: none; }
main a.wiki-link.broken { background: var(--mc-red-bg); color: var(--mc-red); text-decoration: line-through; }
main .ref-internal { color: var(--mc-muted); font-style: italic; border-bottom: 1px dotted var(--mc-muted); cursor: help; }
main .ref-broken { color: var(--mc-muted); font-style: italic; }
main hr { border: 0; border-top: 1px solid var(--mc-border); margin: 30px 0; }
/* Pictos issus d'emojis convertis (couleur sémantique charte) */
.emo { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.17em; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin: 0 2px; }
.emo-red { stroke: var(--mc-red); }
.emo-alert { stroke: var(--mc-alert); }
.emo-green { stroke: var(--mc-green); }

/* Cartouche chat Luca — colonne centrale, premier niveau (calque du module compta) */
.luca-card { background: var(--mc-surface); border: 1px solid var(--mc-border); border-radius: 14px; padding: 16px; margin-bottom: 28px; box-shadow: 0 1px 2px rgba(23,34,47,0.04); }
.luca-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.luca-avatar { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #4E97DE, #1F66AC); display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.luca-avatar svg { width: 20px; height: 20px; stroke: #fff; stroke-width: 1.5; fill: none; }
.luca-head .who { font-weight: 600; color: var(--mc-ink); }
.luca-head .tag { font-family: var(--mc-mono); font-size: 11px; color: var(--mc-muted); background: var(--mc-bg); padding: 2px 8px; border-radius: 99px; }
.luca-intro { font-size: 13px; color: var(--mc-muted); margin: 0 0 12px; }
.luca-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.luca-thread:empty { display: none; }
.luca-msg { padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.55; }
.luca-msg.user { background: #E4EFF9; color: var(--mc-ink); align-self: flex-end; border-bottom-right-radius: 4px; max-width: 85%; }
.luca-msg.bot { background: var(--mc-soft); color: var(--mc-text); border: 1px solid var(--mc-soft-line); align-self: flex-start; border-bottom-left-radius: 4px; max-width: 92%; }
.luca-msg.bot p { margin: 0 0 8px; } .luca-msg.bot p:last-child { margin: 0; }
.luca-msg.pending { color: var(--mc-muted); font-style: italic; }
.luca-cites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.luca-cite { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; background: var(--mc-ranged-bg); border: 1px solid var(--mc-code-bg); color: var(--mc-ranged); padding: 3px 9px; border-radius: 99px; }
.luca-cite:hover { border-color: var(--mc-primary); text-decoration: none; }
.luca-form { display: flex; gap: 8px; align-items: center; }
.luca-inputbox { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--mc-soft); border: 1px solid var(--mc-border); border-radius: var(--mc-radius); padding: 9px 12px; }
.luca-inputbox:focus-within { border-color: var(--mc-primary); box-shadow: 0 0 0 3px rgba(44,130,208,0.12); }
.luca-inputbox svg { color: var(--mc-muted); }
.luca-inputbox input { flex: 1; border: 0; outline: 0; background: transparent; font-family: inherit; font-size: 14px; color: var(--mc-text); }
.luca-send { display: inline-flex; align-items: center; gap: 6px; background: var(--mc-primary); color: #fff; border: 0; border-radius: var(--mc-radius); padding: 10px 15px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
.luca-send:hover { background: var(--mc-primary-600); }
.luca-send:disabled { opacity: 0.5; cursor: default; }
.luca-hint { font-size: 12px; color: var(--mc-muted); margin-top: 8px; }
.luca-gate { background: var(--mc-soft); border: 1px solid var(--mc-soft-line); border-radius: 12px; padding: 14px; }
.luca-gate p { margin: 0 0 10px; font-size: 13px; color: var(--mc-text); }
.luca-gate .row { display: flex; gap: 8px; }
.luca-gate input { flex: 1; border: 1px solid var(--mc-border); border-radius: var(--mc-radius); padding: 9px 12px; font-family: inherit; font-size: 14px; color: var(--mc-text); background: var(--mc-surface); }
.luca-gate input:focus { outline: 0; border-color: var(--mc-primary); box-shadow: 0 0 0 3px rgba(44,130,208,0.12); }

/* Sidebar droite : connexion + CTA abonnement */
.sidebar-right { background: var(--mc-surface); border-left: 1px solid var(--mc-border); }
.right-inner { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding: 22px 18px; }
.auth-box { border: 1px solid var(--mc-border); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.auth-box .lbl { font-size: 12px; color: var(--mc-muted); text-align: center; margin-bottom: 10px; }
.auth-box .btn-ghost { margin-top: 0; margin-bottom: 8px; }
.auth-box .btn-ghost:last-child { margin-bottom: 0; }
.cta-card { border: 1px solid var(--mc-border); border-radius: 14px; padding: 18px; text-align: center; margin-bottom: 16px; }
.cta-card img { width: 40px; height: 40px; border-radius: 10px; margin-bottom: 10px; }
.cta-card h3 { margin: 0 0 6px; font-size: 15px; color: var(--mc-ink); }
.cta-card p { margin: 0 0 14px; font-size: 13px; color: var(--mc-muted); line-height: 1.5; }
.cta-card ul { list-style: none; margin: 0 0 14px; padding: 0; text-align: left; }
.cta-card li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--mc-text); margin-bottom: 8px; }
.cta-card li svg { color: var(--mc-green); margin-top: 2px; }
.cta-card .price { font-family: var(--mc-mono); font-size: 22px; font-weight: 700; color: var(--mc-ink); }
.cta-card .price span { font-size: 12px; font-weight: 400; color: var(--mc-muted); }
.btn-primary { display: block; width: 100%; background: var(--mc-primary); color: #fff; border: 0; border-radius: var(--mc-radius); padding: 11px 14px; font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; font-family: inherit; }
.btn-primary:hover { background: var(--mc-primary-600); text-decoration: none; color: #fff; }
.btn-ghost { display: block; width: 100%; background: var(--mc-surface); color: var(--mc-primary-600); border: 1px solid var(--mc-border); border-radius: var(--mc-radius); padding: 9px 14px; font-size: 13px; font-weight: 500; cursor: pointer; text-align: center; margin-top: 8px; font-family: inherit; }
.btn-ghost:hover { border-color: var(--mc-primary); text-decoration: none; }
.side-remarks { border-top: 1px solid var(--mc-border); margin-top: 4px; padding-top: 16px; }
.side-remarks h3 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mc-ink); }
.side-remarks .hint { font-size: 12px; color: var(--mc-muted); margin-bottom: 10px; }
.side-remarks textarea { width: 100%; min-height: 160px; padding: 10px; border: 1px solid var(--mc-border); border-radius: var(--mc-radius); font-family: inherit; font-size: 13px; resize: vertical; color: var(--mc-text); }
.side-remarks textarea:focus { border-color: var(--mc-primary); outline: 2px solid rgba(44,130,208,0.15); }
.side-remarks .saved-mark { font-size: 11px; color: var(--mc-green); margin-top: 6px; min-height: 14px; }

/* Panneau admin : publication (WP-like) + fiches à valider */
.pub-block { border: 1px solid var(--mc-border); border-radius: 12px; padding: 12px; margin-bottom: 16px; }
.pub-state { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--mc-ink); margin-bottom: 10px; }
.pub-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pub-dot.on { background: var(--mc-green); }
.pub-dot.off { background: var(--mc-alert); }
.valid-block { border-top: 1px solid var(--mc-border); margin-top: 16px; padding-top: 14px; }
.valid-block h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mc-ink); }
.vl-count { font-size: 11px; color: var(--mc-muted); font-family: var(--mc-mono); margin-bottom: 8px; }
.vl-empty { font-size: 12px; color: var(--mc-muted); }
.vl-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--mc-soft); }
.vl-title { flex: 1; min-width: 0; font-size: 12px; color: var(--mc-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vl-pub { flex: none; background: var(--mc-primary); color: #fff; border: 0; border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.vl-pub:hover { background: var(--mc-primary-600); }
.vl-pub:disabled { opacity: 0.5; }

/* Index */
.index-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.index-section { margin-bottom: 26px; }
.index-section h2 { margin-bottom: 14px; }
.index-card { display: block; padding: 12px 14px; background: var(--mc-surface); border: 1px solid var(--mc-border); border-radius: var(--mc-radius); color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.index-card:hover { border-color: var(--mc-primary); box-shadow: 0 1px 3px rgba(44,130,208,0.12); text-decoration: none; }
.index-card .title { font-weight: 600; color: var(--mc-ink); margin-bottom: 2px; }
.index-card .tags { font-size: 11px; color: var(--mc-muted); font-family: var(--mc-mono); }

/* Footer */
.footer { padding: 24px 0 8px; color: var(--mc-muted); font-size: 12px; border-top: 1px solid var(--mc-border); margin-top: 36px; }

/* ————— MOBILE (placé en FIN de feuille pour override les règles desktop ci-dessus) —————
   Charte : "mobile = consultation". Wiki de contenu → hamburger + tiroir de nav ;
   la colonne login + CTA passe SOUS le contenu au lieu de disparaître. */
@media (max-width: 1100px) {
  .mobile-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 40; background: var(--mc-surface); border-bottom: 1px solid var(--mc-border); padding: 10px 14px; }
  .mobile-topbar .mt-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--mc-ink); font-size: 15px; }
  .mobile-topbar .mt-brand:hover { text-decoration: none; }
  .mobile-topbar .mt-brand img { width: 28px; height: 28px; border-radius: 7px; }
  .mt-burger { background: var(--mc-surface); border: 1px solid var(--mc-border); border-radius: var(--mc-radius); padding: 6px 8px; color: var(--mc-ink); cursor: pointer; display: inline-flex; }
  .mt-burger svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
  .mt-burger:focus-visible { outline: 0; box-shadow: 0 0 0 3px #D7E9FB; }

  .layout { display: block; }
  main { padding: 18px 16px; max-width: none; }

  /* Sidebar gauche → tiroir off-canvas */
  .sidebar-left { position: fixed; top: 0; left: 0; width: 300px; max-width: 84vw; height: 100vh; z-index: 60; transform: translateX(-100%); transition: transform .25s ease; border-right: 1px solid var(--mc-border); }
  body.nav-open .sidebar-left { transform: translateX(0); }
  .drawer-overlay { display: block; position: fixed; inset: 0; background: rgba(23,34,47,.45); opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 55; }
  body.nav-open .drawer-overlay { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .drawer-close { display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--mc-muted); cursor: pointer; padding: 4px; margin-left: auto; }
  .drawer-close svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

  /* Colonne droite (login + CTA) → sous le contenu, pleine largeur */
  .sidebar-right { position: static; height: auto; border-left: 0; border-top: 1px solid var(--mc-border); padding: 0; }
  .right-inner { position: static; max-height: none; overflow: visible; padding: 22px 16px; }
  .auth-box, .cta-card { max-width: 520px; margin-left: auto; margin-right: auto; }
}
