/* Portail scerbo.ca – thème clair pastel */
:root {
  --font: Aptos, "Aptos Display", Calibri, "Segoe UI Variable Text", "Segoe UI", Carlito, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --bg: #ffffff;            /* page blanche ; bandeaux, menus et cadres en crème très clair */
  --app-bg: #ffffff;
  --surface: #fcf8f0;
  --surface-2: #f8f3e8;
  --line: #ebe4d6;
  --line-2: #ddd5c4;
  --text: #2c2a3a;
  --muted: #6f6b82;
  --accent: #6c5ec9;
  --accent-soft: #ece8fb;
  --accent-ink: #4b3fa6;
  --ok: #2f8a63; --ok-soft: #e2f5ec;
  --warn: #a8741a; --warn-soft: #fbf1d9;
  --err: #b4483e; --err-soft: #fbe7e4;
  --info: #2f6fa8; --info-soft: #e2f0fb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(70, 52, 25, .05), 0 6px 18px rgba(70, 52, 25, .06);
  --shadow-lg: 0 10px 40px rgba(44, 42, 58, .14);
  --topbar: 58px;
  --sidebar: 286px;
  --tint: #ece8fb; --ink: #6c5ec9;
  --chip: #f1eff7;
  --hover: #f4f2fa;
  --row: #fdfaf4;
  --row-line: #f1ebdf;
  --text-2: #4b4860;
  --topbar-bg: rgba(252,248,240,.94);
  --glass: rgba(252,248,240,.96);
  --glass-2: rgba(255,255,255,.7);
  --input-bg: #fff;
  --hero: linear-gradient(120deg, #ece8fb 0%, #e2f5ec 55%, #fde9df 100%);
  --login-bg: linear-gradient(135deg, #ece8fb 0%, #e2f0fb 45%, #e2f5ec 100%);
  color-scheme: light;
}
:root[data-theme=dark] {
  --bg: #17161d; --app-bg: #17161d; --surface: #201f28; --surface-2: #24232d;
  --line: #34323f; --line-2: #403e4d; --text: #ebe9f2; --text-2: #c9c6d6; --muted: #a29fb3;
  --accent: #a99cf0; --accent-soft: #2e2a48; --accent-ink: #c9c0ff;
  --ok: #6fd1a5; --ok-soft: #1c3a2e; --warn: #e7c06a; --warn-soft: #3a3020; --err: #f0948a; --err-soft: #3d2422; --info: #8cc0ee; --info-soft: #1d2f40;
  --chip: #2b2a35; --hover: #2a2934; --row: #23222b; --row-line: #2c2a35;
  --topbar-bg: rgba(32,31,40,.9); --glass: rgba(32,31,40,.95); --glass-2: rgba(255,255,255,.08); --input-bg: #1b1a22;
  --hero: linear-gradient(120deg, #2a2640 0%, #1f3129 55%, #3a2a24 100%);
  --login-bg: linear-gradient(135deg, #221f35 0%, #1b2836 45%, #1b2e27 100%);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme=auto] {
  --bg: #17161d; --app-bg: #17161d; --surface: #201f28; --surface-2: #24232d;
  --line: #34323f; --line-2: #403e4d; --text: #ebe9f2; --text-2: #c9c6d6; --muted: #a29fb3;
  --accent: #a99cf0; --accent-soft: #2e2a48; --accent-ink: #c9c0ff;
  --ok: #6fd1a5; --ok-soft: #1c3a2e; --warn: #e7c06a; --warn-soft: #3a3020; --err: #f0948a; --err-soft: #3d2422; --info: #8cc0ee; --info-soft: #1d2f40;
  --chip: #2b2a35; --hover: #2a2934; --row: #23222b; --row-line: #2c2a35;
  --topbar-bg: rgba(32,31,40,.9); --glass: rgba(32,31,40,.95); --glass-2: rgba(255,255,255,.08); --input-bg: #1b1a22;
  --hero: linear-gradient(120deg, #2a2640 0%, #1f3129 55%, #3a2a24 100%);
  --login-bg: linear-gradient(135deg, #221f35 0%, #1b2836 45%, #1b2e27 100%);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
  }

/* Teintes pastel adoucies sur fond sombre */
:root[data-theme=auto] :is(.chip, .tile-ico, .page-head, .appbar-title .ico, .tree-dot, .tree .depth-0 > li > details > summary > a .ico, .tree .depth-0 > li > a .ico, .prose thead th, .prose blockquote, .tree .current > a, .tree .current > details > summary > a) {
  background: color-mix(in srgb, var(--tint) 16%, var(--surface)); }
:root[data-theme=auto] :is(.chip, .tile-meta, .tree .current > a, .tree .current > details > summary > a) { color: color-mix(in srgb, var(--ink) 55%, white); }
:root[data-theme=auto] .page-head h1 { color: var(--text); }
:root[data-theme=auto] .flash-success { color: var(--ok); border-color: #2c5a48; }
:root[data-theme=auto] .flash-error { color: var(--err); border-color: #5a332f; }
:root[data-theme=auto] .flash-info { color: var(--info); border-color: #2b4560; }
:root[data-theme=auto] .btn-primary:hover { background: #8e7fe6; }
:root[data-theme=auto] .btn-primary { color: #17161d; }
}

/* Teintes pastel adoucies sur fond sombre */
:root[data-theme=dark] :is(.chip, .tile-ico, .page-head, .appbar-title .ico, .tree-dot, .tree .depth-0 > li > details > summary > a .ico, .tree .depth-0 > li > a .ico, .prose thead th, .prose blockquote, .tree .current > a, .tree .current > details > summary > a) {
  background: color-mix(in srgb, var(--tint) 16%, var(--surface)); }
:root[data-theme=dark] :is(.chip, .tile-meta, .tree .current > a, .tree .current > details > summary > a) { color: color-mix(in srgb, var(--ink) 55%, white); }
:root[data-theme=dark] .page-head h1 { color: var(--text); }
:root[data-theme=dark] .flash-success { color: var(--ok); border-color: #2c5a48; }
:root[data-theme=dark] .flash-error { color: var(--err); border-color: #5a332f; }
:root[data-theme=dark] .flash-info { color: var(--info); border-color: #2b4560; }
:root[data-theme=dark] .btn-primary:hover { background: #8e7fe6; }
:root[data-theme=dark] .btn-primary { color: #17161d; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15.5px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .86em; background: var(--chip); padding: .08em .35em; border-radius: 5px; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Barre supérieure ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: .9rem; padding: 0 1rem;
  background: var(--topbar-bg); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); text-decoration: none !important; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #a99cf0, #7fc8b0); box-shadow: 0 2px 8px rgba(108,94,201,.3); }
.brand-mark.big { width: 52px; height: 52px; border-radius: 15px; font-size: 1.5rem; }
.brand-name { font-weight: 650; font-size: 1.08rem; } .brand-name span, .login-brand h1 span { color: var(--accent); font-weight: 500; }
.search { flex: 1; max-width: 420px; margin-left: 1rem; }
.search input { width: 100%; padding: .48rem .9rem .48rem 2.2rem; border-radius: 999px; border: 1px solid var(--line); background: var(--hover) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236f6b82' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat .8rem center; font: inherit; }
.search input:focus { outline: none; border-color: var(--accent); background-color: var(--input-bg); box-shadow: 0 0 0 3px var(--accent-soft); }
.usermenu { margin-left: auto; }
.icon-btn { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 .4rem; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.icon-btn:hover { background: var(--chip); color: var(--text); }
.icon-btn.danger:hover { background: var(--err-soft); color: var(--err); }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .25rem .5rem .25rem .25rem; border-radius: 999px; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover { background: var(--chip); }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .4rem; z-index: 40; }
.dropdown-panel a, .dropdown-panel button { display: block; width: 100%; text-align: left; padding: .5rem .7rem; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown-panel a:hover, .dropdown-panel button:hover { background: var(--hover); text-decoration: none; }
.dropdown-panel.form { padding: .8rem; min-width: 260px; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.uname { font-weight: 550; }

/* ---------- Mise en page ---------- */
.layout { display: flex; min-height: calc(100vh - var(--topbar)); }
.sidebar { width: var(--sidebar); flex: 0 0 var(--sidebar); background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: var(--topbar);
  height: calc(100vh - var(--topbar)); overflow-y: auto; display: flex; flex-direction: column; transition: margin .2s ease; }
.nav-closed .sidebar { margin-left: calc(-1 * var(--sidebar)); }
.content { flex: 1; min-width: 0; padding: 1.4rem clamp(1rem, 3vw, 2.4rem) 3rem; }
.content-app { padding: 0; display: flex; flex-direction: column; height: calc(100vh - var(--topbar)); }
.content-app .crumbs { padding: .55rem 1.2rem 0; margin: 0; }
.content-app > .flash { margin: .6rem 1.2rem 0; }

/* ---------- Arborescence ---------- */
.tree { padding: .8rem .6rem; flex: 1; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree .depth-1, .tree .depth-2, .tree .depth-3, .tree .depth-4 { margin-left: .9rem; padding-left: .45rem; border-left: 1px dashed var(--line-2); }
.tree a, .tree .disabled, .tree summary { display: flex; align-items: center; gap: .55rem; padding: .38rem .55rem; border-radius: 9px; color: var(--text); font-size: .94rem; text-decoration: none; }
.tree summary { list-style: none; cursor: pointer; padding: 0; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary > a { flex: 1; min-width: 0; }
.tree a:hover { background: var(--hover); }
.tree .ico { width: 1.5rem; text-align: center; flex: 0 0 1.5rem; font-size: 1.02rem; }
.tree .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .chev { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); }
.tree .chev::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.tree details[open] > summary .chev::before { transform: rotate(45deg); }
.tree .chev:hover { background: var(--chip); }
.tree .depth-0 > li > details > summary > a, .tree .depth-0 > li > a { font-weight: 600; }
.tree .depth-0 > li > details > summary > a .ico, .tree .depth-0 > li > a .ico { background: var(--tint); border-radius: 8px; height: 1.6rem; display: grid; place-items: center; }
.tree .current > a, .tree .current > details > summary > a { background: var(--tint, var(--accent-soft)); color: var(--ink, var(--accent-ink)); font-weight: 600; }
.tree li.current > a { background: var(--accent-soft); color: var(--accent-ink); }
.tree .disabled { color: var(--muted); cursor: default; }
.tree .soon .lbl { color: var(--muted); }
.tree .is-hidden .lbl { text-decoration: line-through dotted; }
.tree-home { font-weight: 600; margin-bottom: .3rem; }
.tree-home .ico { background: var(--chip); border-radius: 8px; height: 1.6rem; display: grid; place-items: center; }
.tree-home.current { background: var(--accent-soft); }
.badge-soon { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--chip); padding: .1rem .4rem; border-radius: 6px; }
.tree li.search-miss { display: none; }
.sidebar-foot { border-top: 1px solid var(--line); padding: .7rem 1rem; font-size: .9rem; }
.sidebar-foot a { color: var(--muted); }

/* ---------- Fil d'Ariane, en-têtes ---------- */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.crumbs a { color: var(--muted); } .crumbs .sep { opacity: .6; }
.hero { padding: 1.6rem 1.8rem; border-radius: var(--radius); background: var(--hero); margin-bottom: 1.6rem; }
.hero h1 { font-size: 1.85rem; margin-bottom: .2rem; } .hero p { margin: 0; color: var(--text-2); }
.section-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; margin: 1.6rem 0 .8rem; }
.page-head { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.3rem; border-radius: var(--radius); background: var(--tint); margin-bottom: 1.4rem; }
.page-head h1 { margin: 0; color: var(--text); } .page-head p { margin: .15rem 0 0; color: var(--text-2); }
.page-ico { font-size: 1.9rem; width: 3.2rem; height: 3.2rem; display: grid; place-items: center; background: var(--glass-2); border-radius: 14px; flex: 0 0 auto; }
.page-edit { margin-left: auto; }

/* ---------- Tuiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.tile { display: flex; gap: .9rem; align-items: flex-start; padding: 1.05rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); text-decoration: none !important; box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease, border-color .12s; position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--ink); opacity: .55; }
a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.tile-ico { font-size: 1.55rem; width: 3rem; height: 3rem; flex: 0 0 3rem; display: grid; place-items: center; border-radius: 12px; background: var(--tint); }
.tile-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.tile-title { font-weight: 650; font-size: 1.02rem; }
.tile-sum { font-size: .88rem; color: var(--muted); }
.tile-meta { font-size: .76rem; color: var(--ink); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: .2rem; }
.tile-soon { opacity: .72; } .tile-soon .tile-ico { filter: grayscale(.4); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .85rem; border-radius: 999px; background: var(--tint); color: var(--ink); font-weight: 600; font-size: .92rem; text-decoration: none !important; border: 1px solid rgba(0,0,0,.03); }
.chip:hover { filter: brightness(.97); }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; } .grid-2 .card { margin: 0; }
.span-2 { grid-column: 1 / -1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--err-soft); border-color: #f0c9c3; color: var(--err); }
.btn-sm { padding: .38rem .7rem; font-size: .88rem; border-radius: 9px; }
.btn-xs { padding: .22rem .5rem; font-size: .8rem; border-radius: 7px; }
.btn-block { width: 100%; }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 6px; background: var(--chip); color: var(--muted); font-size: .78rem; font-weight: 600; }
.tag-strong { background: var(--accent-soft); color: var(--accent-ink); } .tag-warn { background: var(--warn-soft); color: var(--warn); }
.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: #1f6b4b; border-color: #c6eadb; }
.flash-error { background: var(--err-soft); color: #8e342b; border-color: #f2cbc5; }
.flash-info { background: var(--info-soft); color: #22557f; border-color: #c9e0f3; }
.empty-state { text-align: center; padding: 3rem 1rem; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty-ico { font-size: 2.6rem; margin-bottom: .4rem; }
.empty-state p { color: var(--muted); max-width: 46ch; margin: .3rem auto; }

/* ---------- Formulaires ---------- */
.form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; margin-bottom: .8rem; }
.form label small { font-weight: 400; color: var(--muted); }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form select, .form textarea, .inline-form select, .space-picker select, .docs input[type=text], .docs input[type=date] {
  font: inherit; font-weight: 400; padding: .55rem .7rem; border: 1px solid var(--line-2); border-radius: 9px; background: var(--input-bg); color: var(--text); width: 100%; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; }
.form-grid h2 { margin-top: .6rem; }
.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 35%); padding: 1rem 0; }
.checks { display: flex; flex-direction: column; gap: .3rem; }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 650; padding: 0 .3rem; }
.inline, .inline-form { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form { margin-top: .6rem; } .inline-form select { width: auto; }
.danger-zone { margin: 1.5rem 0; }
.editor-form textarea { width: 100%; min-height: 480px; }

/* ---------- Tableaux ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
.table tr:hover td { background: var(--row); }
.perm-table select { padding: .3rem .5rem; border-radius: 8px; border: 1px solid var(--line-2); font: inherit; font-size: .88rem; }
.perm-table tr.depth-0 td { font-weight: 650; background: var(--row); }
.lvl-badge { font-size: .76rem; font-weight: 650; padding: .12rem .5rem; border-radius: 6px; background: var(--chip); color: var(--muted); }
.lvl-badge.lvl-1 { background: var(--info-soft); color: var(--info); } .lvl-badge.lvl-2 { background: var(--ok-soft); color: var(--ok); } .lvl-badge.lvl-3 { background: var(--accent-soft); color: var(--accent-ink); }
.tree-dot { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 8px; background: var(--tint); margin-right: .25rem; }

/* ---------- Administration ---------- */
.admin-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1.2rem; padding: .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.admin-tabs a { display: inline-flex; gap: .4rem; align-items: center; padding: .45rem .8rem; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .92rem; text-decoration: none; }
.admin-tabs a:hover { background: var(--hover); color: var(--text); }
.admin-tabs a.current { background: var(--accent-soft); color: var(--accent-ink); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; display: flex; flex-direction: column; }
.stat b { font-size: 1.5rem; font-weight: 700; } .stat span { color: var(--muted); font-size: .84rem; }
.stat-warn { background: var(--warn-soft); }
.pager { display: flex; gap: .5rem; }

/* ---------- Contenu enrichi ---------- */
.prose { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem clamp(1rem, 3vw, 2.2rem); box-shadow: var(--shadow); margin-bottom: 1.2rem; max-width: 1100px; }
.prose h2 { margin-top: 1.6em; font-size: 1.3rem; } .prose h3 { margin-top: 1.4em; font-size: 1.1rem; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p, .prose li { max-width: 80ch; }
.prose .lead { font-size: 1.08rem; color: var(--text-2); }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose table { border-collapse: collapse; width: 100%; margin: 1rem 0 1.4rem; font-size: .9rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.prose thead th, .prose tr:first-child th { background: var(--tint); }
.prose tbody tr:nth-child(even) td { background: var(--row); }
.prose blockquote { margin: 1rem 0; padding: .6rem 1rem; border-left: 4px solid var(--ink); background: var(--tint); border-radius: 0 8px 8px 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* ---------- Application intégrée ---------- */
.appbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.appbar-title { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.appbar-title h1 { font-size: 1.08rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-title .ico { font-size: 1.2rem; width: 2.1rem; height: 2.1rem; display: grid; place-items: center; background: var(--tint); border-radius: 10px; }
.appbar-title .ver { font-size: .75rem; color: var(--muted); background: var(--chip); padding: .05rem .4rem; border-radius: 6px; }
.appbar-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.space-picker label { display: flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--muted); font-weight: 600; margin: 0; }
.space-picker select { width: auto; padding: .32rem .6rem; }
.save-pill { font-size: .8rem; font-weight: 600; padding: .25rem .65rem; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.save-pill[data-state=saved] { background: var(--ok-soft); color: var(--ok); }
.save-pill[data-state=saving], .save-pill[data-state=dirty] { background: var(--info-soft); color: var(--info); }
.save-pill[data-state=error], .save-pill[data-state=auth], .save-pill[data-state=conflict] { background: var(--err-soft); color: var(--err); }
.save-pill[data-state=readonly], .save-pill[data-state=readonly-mode] { background: var(--warn-soft); color: var(--warn); }
.count:empty { display: none; }
.count { background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 0 .4rem; font-size: .75rem; }
.app-stage { flex: 1; display: flex; min-height: 0; position: relative; }
.app-frame { flex: 1; width: 100%; border: 0; background: var(--app-bg); }
.docs { width: 360px; flex: 0 0 360px; border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; padding: 1rem; overflow-y: auto; }
.docs-head { display: flex; justify-content: space-between; align-items: center; } .docs-head h2 { margin: 0; }
.docs-sub { font-size: .84rem; color: var(--muted); margin: .2rem 0 .8rem; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: 1.1rem; border: 2px dashed var(--line-2); border-radius: 12px; text-align: center; cursor: pointer; color: var(--muted); background: var(--surface-2); }
.dropzone input { display: none; } .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone small { font-size: .76rem; }
.docs .row { display: flex; gap: .4rem; margin: .5rem 0 1rem; } .docs .row input[type=text] { flex: 1; } .docs .row input[type=date] { width: 140px; flex: 0 0 auto; }
.docs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.docs-list li.doc { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem; border: 1px solid var(--line); border-radius: 10px; }
.doc-ico { font-size: 1.3rem; } .doc-main { flex: 1; min-width: 0; }
.doc-main a { font-weight: 600; word-break: break-word; } .doc-meta { font-size: .78rem; color: var(--muted); }
.doc-desc { font-size: .85rem; }
.doc-actions { display: flex; flex-direction: column; gap: .2rem; }
.progress { height: 4px; background: var(--accent-soft); border-radius: 4px; overflow: hidden; } .progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ---------- Connexion ---------- */
.mode-bare { background: var(--login-bg); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 410px; background: var(--glass); border: 1px solid var(--line); border-radius: 20px; padding: 2rem; box-shadow: var(--shadow-lg); }
.login-card.wide { max-width: 640px; }
.login-brand { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.4rem; }
.login-brand h1 { margin: 0; font-size: 1.5rem; } .login-brand p { margin: 0; color: var(--muted); }
.sso { display: flex; flex-direction: column; gap: .55rem; }
.btn-sso { display: flex; align-items: center; justify-content: center; gap: .65rem; padding: .65rem 1rem; border: 1px solid var(--line-2); border-radius: 11px; color: var(--text); font-weight: 600; background: var(--input-bg); text-decoration: none !important; }
.btn-sso:hover { background: var(--hover); border-color: #c9c4da; }
.or { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .85rem; margin: 1.1rem 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-foot { font-size: .8rem; color: var(--muted); margin: 1.2rem 0 0; text-align: center; }
.checklist { list-style: none; padding: 0; columns: 2; font-size: .88rem; } .checklist .ok { color: var(--ok); } .checklist .ko { color: var(--err); font-weight: 700; }

/* ---------- Réactif ---------- */
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: var(--topbar); z-index: 25; box-shadow: var(--shadow-lg); margin-left: calc(-1 * var(--sidebar)); }
  .nav-open .sidebar { margin-left: 0; }
  .nav-closed .sidebar { margin-left: calc(-1 * var(--sidebar)); }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .search { display: none; }
  .uname { display: none; }
  .docs { position: absolute; right: 0; top: 0; bottom: 0; width: min(360px, 100%); z-index: 5; box-shadow: var(--shadow-lg); }
  .appbar-title h1 { max-width: 46vw; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .content { padding: 1rem 1rem 2.5rem; }
  .tiles { grid-template-columns: 1fr; }
  .hero { padding: 1.2rem; } .hero h1 { font-size: 1.45rem; }
  .table { display: block; overflow-x: auto; }
  .checklist { columns: 1; }
}
@media print { .topbar, .sidebar, .appbar, .admin-tabs, .page-edit { display: none !important; } body { background: var(--input-bg); } .prose { border: 0; box-shadow: none; } }

/* ---------- Choix de l'apparence (Mon compte) ---------- */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.form .theme-opt { flex-direction: row; align-items: center; gap: .8rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; margin: 0; font-weight: 400; }
.form .theme-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-opt input { accent-color: var(--accent); }
.theme-opt b { display: block; font-weight: 650; }
.theme-opt small { display: block; color: var(--muted); font-size: .82rem; }
.swatch { display: inline-flex; flex: 0 0 auto; width: 54px; height: 38px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-2); }
.swatch i { flex: 1; }
.swatch-creme i:nth-child(1) { background: #fbf8f2; } .swatch-creme i:nth-child(2) { background: #ffffff; } .swatch-creme i:nth-child(3) { background: #ece8fb; }
.swatch-auto i:nth-child(1) { background: #fbf8f2; } .swatch-auto i:nth-child(2) { background: #8a87a0; } .swatch-auto i:nth-child(3) { background: #201f28; }
.swatch-sombre i:nth-child(1) { background: #17161d; } .swatch-sombre i:nth-child(2) { background: #201f28; } .swatch-sombre i:nth-child(3) { background: #2e2a48; }

/* Barres de comparaison dans les pages de contenu */
.prose .bars { max-width: 760px; margin: .4rem 0 1rem; }
.prose .bars p { margin: .7rem 0 .25rem; }
.prose .bars div { margin: .2rem 0; border-radius: 6px; padding: .18rem .5rem; font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
:root[data-theme=dark] .prose .bars div { filter: brightness(.45) saturate(1.3); color: #fff; }

/* ---- Favoris ---- */
.tree-favs { margin: .2rem 0 .6rem; padding-bottom: .5rem; border-bottom: 1px dashed var(--line); }
.tree-favs-title { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 650; padding: .35rem .7rem .2rem; }
.tree.searching .tree-favs { display: none; }
.fav-btn .fav-star { font-size: 1.05em; line-height: 1; }
.fav-btn[aria-pressed=true] { color: #b7791f; border-color: #e8c98a; background: #fdf6e7; }
:root[data-theme=dark] .fav-btn[aria-pressed=true] { color: #e7c06a; border-color: #5a4a26; background: #2e2716; }
@media (prefers-color-scheme: dark) { :root[data-theme=auto] .fav-btn[aria-pressed=true] { color: #e7c06a; border-color: #5a4a26; background: #2e2716; } }
.page-head-tools { margin-left: auto; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.page-head .page-edit { margin-left: 0; }
.fav-hint { margin-top: -.2rem; }
@media (max-width: 640px) { .fav-btn .fav-lbl { display: none; } }
