/* ==========================================================================
   SkolForum — thème "default"
   Mobile d'abord · clair/sombre · RTL (propriétés logiques) · sans police externe
   Pour créer un thème : copier ce dossier et modifier les variables de :root.
   ========================================================================== */

:root {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #f1eee8;
  --border: #e4dfd6;
  --text: #1f1d1a;
  --muted: #6f6a61;
  --primary: #0f766e;
  --primary-ink: #ffffff;
  --primary-soft: #e3f3f1;
  --accent: #c2410c;
  --danger: #b91c1c;
  --danger-soft: #fdecec;
  --success: #15803d;
  --success-soft: #e8f6ec;
  --info-soft: #e8f0fb;
  --warn-soft: #fdf4e3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(30 25 15 / .06), 0 4px 16px rgb(30 25 15 / .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --container: 1100px;
  --gutter: 16px;
}

:root[data-theme="dark"] {
  --bg: #121614;
  --surface: #1a201e;
  --surface-2: #222a27;
  --border: #2f3935;
  --text: #e8ece9;
  --muted: #9aa6a1;
  --primary: #2dd4bf;
  --primary-ink: #062b27;
  --primary-soft: #133a35;
  --accent: #fb923c;
  --danger: #f87171;
  --danger-soft: #3a1a1a;
  --success: #4ade80;
  --success-soft: #16301f;
  --info-soft: #1a2638;
  --warn-soft: #352a14;
  --shadow: 0 1px 2px rgb(0 0 0 / .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --surface: #1a201e; --surface-2: #222a27; --border: #2f3935;
    --text: #e8ece9; --muted: #9aa6a1; --primary: #2dd4bf; --primary-ink: #062b27;
    --primary-soft: #133a35; --accent: #fb923c; --danger: #f87171; --danger-soft: #3a1a1a;
    --success: #4ade80; --success-soft: #16301f; --info-soft: #1a2638; --warn-soft: #352a14;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--font);
}
main { flex: 1; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }
h2 { font-size: 1.25rem; }
img { max-width: 100%; height: auto; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
pre { background: var(--surface-2); padding: 12px 14px; border-radius: var(--radius-sm); overflow-x: auto; }
pre code { background: none; padding: 0; }
/* Code et formules restent de gauche à droite, même en arabe */
pre, code, .katex { direction: ltr; unicode-bidi: isolate; }
pre { text-align: left; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding-block: 4px; }
blockquote { margin: .8em 0; padding: .5em 1em; border-inline-start: 4px solid var(--primary); background: var(--surface-2); border-radius: var(--radius-sm); border-start-start-radius: 0; border-end-start-radius: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.skip-link { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--primary); color: var(--primary-ink); padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip-link:focus { inset-inline-start: 8px; }

.icon { flex-shrink: 0; vertical-align: -3px; }

/* ---------- En-tête ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
  background: var(--primary); color: var(--primary-ink); border-radius: 10px; font-weight: 800;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: .75rem; }

.nav-wrap { order: 3; position: relative; }
.main-nav {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 220px;
  display: none; flex-direction: column; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.main-nav a { padding: 10px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); font-weight: 500; }
.main-nav a:hover { background: var(--surface-2); }
.main-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.nav-wrap.open .main-nav { display: flex; }

.header-actions { order: 2; display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid transparent; border-radius: 10px; background: none; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; }
.user-chip:hover { background: var(--surface-2); }
.dropdown {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 200px; z-index: 30;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.dropdown a, .dropdown .linklike { padding: 9px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); text-align: start; }
.dropdown a:hover, .dropdown .linklike:hover { background: var(--surface-2); }
.dropdown form { margin: 0; display: flex; flex-direction: column; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; color: var(--primary); padding: 0; }

@media (min-width: 860px) {
  .nav-wrap { order: 2; margin-inline-start: 24px; }
  .nav-toggle { display: none; }
  .main-nav { display: flex; position: static; flex-direction: row; min-width: 0; padding: 0; border: 0; box-shadow: none; background: none; gap: 2px; }
  .main-nav a { padding: 8px 12px; }
  .header-actions { order: 3; }
}

/* ---------- Pied de page ---------- */
.site-footer { margin-top: 48px; border-top: 1px solid var(--border); background: var(--surface); font-size: .875rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-block: 20px; }
.footer-inner a { color: var(--muted); }

/* ---------- Mise en page ---------- */
main.container { padding-top: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .875rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.narrow { max-width: 520px; margin-inline: auto; }
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; font-size: 1.05rem; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 .95rem var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, black); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .875rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form { display: inline; margin: 0; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.form legend { font-weight: 700; margin-bottom: 4px; padding: 0; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .925rem; }
.form label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.form .hint { font-weight: 400; color: var(--muted); font-size: .825rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  font: 400 1rem var(--font);
}
textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }

.editor { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.editor:focus-within { outline: 2px solid var(--primary); border-color: var(--primary); }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: 10px 10px 0 0; }
.editor-toolbar button { min-width: 36px; height: 34px; border: 0; background: none; color: var(--text); border-radius: 6px; cursor: pointer; font: 600 .9rem var(--font); }
.editor-toolbar button:hover { background: var(--surface); }
.editor textarea { border: 0; border-radius: 0 0 10px 10px; outline: none; }
.editor-help { font-size: .8rem; color: var(--muted); padding: 6px 10px; border-top: 1px solid var(--border); }

/* ---------- Alertes ---------- */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error   { background: var(--danger-soft); color: var(--danger); }
.alert-info    { background: var(--info-soft); }
.alert-warning { background: var(--warn-soft); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-accent { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: var(--s, 40px); height: var(--s, 40px); border-radius: 50%;
  background: hsl(var(--h, 170) 45% 42%); color: #fff;
  font-weight: 700; font-size: calc(var(--s, 40px) * .42);
}
.user-link { font-weight: 600; text-decoration: none; }
.user-link.role-admin { color: var(--accent); }

/* ---------- Listes (forums, sujets) ---------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list + .list { margin-top: 20px; }
.list-head { padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.list-head h2 { font-size: 1rem; margin: 0; }
.row { display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px; padding: 14px 16px; border-top: 1px solid var(--border); align-items: center; }
.list-head + .row, .row:first-child { border-top: 0; }
.row:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.row-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); grid-row: span 2; }
.row-icon.is-new { background: var(--primary); color: var(--primary-ink); }
.row-main { min-width: 0; }
.row-title { font-weight: 700; text-decoration: none; color: var(--text); overflow-wrap: anywhere; }
.row-title:hover { color: var(--primary); }
.row-desc { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.row-stats, .row-last { font-size: .825rem; color: var(--muted); grid-column: 2; }
.row-stats b { color: var(--text); }
.row-last { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-last .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 760px) {
  .row { grid-template-columns: 44px minmax(0, 1fr) 170px 220px; }
  .row-icon { grid-row: auto; }
  .row-stats { grid-column: auto; text-align: center; }
  .row-last { grid-column: auto; }
}
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

/* ---------- Messages ---------- */
.post { display: grid; grid-template-columns: 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.post + .post { margin-top: 14px; }
.post-author { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.post-author .meta { display: flex; flex-direction: column; line-height: 1.3; font-size: .8rem; color: var(--muted); }
.post-body { padding: 16px; min-width: 0; }
.post-content { overflow-wrap: anywhere; }
.post-content > :first-child { margin-top: 0; }
.post-content > :last-child { margin-bottom: 0; }
.post-head { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.post-head a { color: var(--muted); text-decoration: none; }
.post-signature { margin-top: 16px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: .85rem; color: var(--muted); }
.post-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
@media (min-width: 760px) {
  .post { grid-template-columns: 180px 1fr; }
  .post-author { flex-direction: column; align-items: center; text-align: center; border-bottom: 0; border-inline-end: 1px solid var(--border); padding: 18px 12px; }
  .post-author .meta { align-items: center; }
}
.post:target { outline: 2px solid var(--primary); }

/* ---------- Tableaux (admin) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.table th, .table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
@media (max-width: 639px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 4px; }
  .table.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--muted); }
}

/* ---------- Admin ---------- */
.admin { display: grid; gap: 20px; }
.admin-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.admin-nav a { padding: 8px 14px; border-radius: 999px; white-space: nowrap; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); font-weight: 500; font-size: .925rem; }
.admin-nav a[aria-current="page"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
@media (min-width: 900px) {
  .admin { grid-template-columns: 220px 1fr; align-items: start; }
  .admin-nav { flex-direction: column; position: sticky; top: 80px; }
  .admin-nav a { border-radius: var(--radius-sm); border: 0; background: none; }
  .admin-nav a:hover { background: var(--surface-2); }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.module-card { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--border); }
.module-card:first-child { border-top: 0; }

/* ---------- Pagination ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 20px 0; }
.pager a, .pager span { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; text-decoration: none; padding: 0 8px; }
.pager a { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.pager a:hover { border-color: var(--primary); }
.pager-current { background: var(--primary); color: var(--primary-ink); font-weight: 700; }

/* ---------- Divers ---------- */
.error-code { font-size: 4rem; font-weight: 800; color: var(--primary); margin: 0; line-height: 1; }
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.search-form { display: flex; gap: 8px; }
.search-form input { flex: 1; }
mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }

/* ---------- Avatar image (module avatars) ---------- */
img.avatar { object-fit: cover; background: var(--surface-2); }

/* ---------- Recadrage (js/cropper.js) ---------- */
.sf-crop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgb(0 0 0 / .65); }
.sf-crop-box { background: var(--surface); border-radius: var(--radius); padding: 16px; max-width: 100%; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.sf-crop-title { margin: 0; font-weight: 700; align-self: flex-start; }
.sf-crop-stage { position: relative; max-width: 100%; touch-action: none; user-select: none; }
.sf-crop-stage canvas { display: block; max-width: 100%; }
.sf-crop-sel { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgb(0 0 0 / .45); cursor: move; touch-action: none; }
.sf-crop-handle { position: absolute; inset-inline-end: -10px; bottom: -10px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; cursor: nwse-resize; }
[dir="rtl"] .sf-crop-handle { inset-inline-end: auto; right: -10px; }

/* ---------- Jauge ---------- */
.gauge { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.gauge > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.gauge.is-warn > span { background: var(--accent); }
.gauge.is-full > span { background: var(--danger); }

@media (max-width: 479px) { .hide-xs { display: none !important; } }
@media (max-width: 639px) { .hide-sm { display: none !important; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media print { .site-header, .site-footer, .post-actions, .pager, .btn { display: none !important; } body { background: #fff; } }

/* ==========================================================================
   v0.3 — composants ajoutés (htmx, Alpine, nouveaux modules)
   ========================================================================== */
[x-cloak] { display: none !important; }
.htmx-request { opacity: .65; transition: opacity .2s; }
.htmx-request.htmx-indicator, .htmx-indicator { opacity: 1; }

/* Bandeau « navigateur non adapté » */
.browser-warning { background: var(--warn-soft); color: var(--text); padding: 10px 16px; text-align: center; font-size: .9rem; border-bottom: 1px solid var(--border); }

/* Message temporaire */
.toast { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 200; max-width: min(420px, calc(100vw - 32px));
  background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: .9rem; }

/* Menu des langues */
.lang-menu .dropdown { min-width: 160px; }
.lang-menu .linklike[aria-current="true"] { font-weight: 700; background: var(--primary-soft); }
.lang-links { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.lang-links a[aria-current="true"] { font-weight: 700; text-decoration: none; }

/* Onglets de filtre (liste des sujets) */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 12px; }
.tabs > a, .tab-active-tag { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); font-size: .875rem; font-weight: 500; }
.tabs > a[aria-current="page"], .tab-active-tag { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.tab-active-tag a { color: inherit; text-decoration: none; margin-inline-start: 4px; }
.tabs-end { margin-inline-start: auto; }

/* Sujets non lus */
.row.is-unread .row-title { font-weight: 800; }
.dot-new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-inline-start: 6px; vertical-align: middle; }
.badge-info { background: var(--info-soft); color: var(--text); }

/* Filtres (recherche, Nouveautés, admin) */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.card.filters { padding: 12px 16px; margin-bottom: 16px; }
.inline-label { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px; font-weight: 600; font-size: .875rem; }
.inline-label select, .inline-label input { width: auto; min-height: 36px; padding: 4px 8px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg label { display: flex !important; flex-direction: row !important; margin: 0; cursor: pointer; font-weight: 500 !important; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { padding: 6px 12px; font-size: .875rem; }
.seg input:checked + span { background: var(--primary); color: var(--primary-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.search-panel { margin-bottom: 16px; }
.more-filters { padding-top: 10px; border-top: 1px dashed var(--border); }
.dropdown-menu { position: relative; }
.dropdown-menu > summary { list-style: none; cursor: pointer; }
.dropdown-menu > summary::-webkit-details-marker { display: none; }
.checklist { max-height: 300px; overflow: auto; gap: 2px; }
.checklist label { padding: 4px 8px; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: .85rem; }
.chip b { color: var(--primary); margin-inline-start: 4px; }
.chip.is-on { border-color: var(--primary); background: var(--primary-soft); }

/* Éditeur : onglets Écrire / Aperçu */
.editor-tabs { margin-inline-start: auto; display: inline-flex; gap: 2px; }
.editor-tabs button[aria-pressed="true"] { background: var(--surface); box-shadow: inset 0 -2px 0 var(--primary); }
.editor-preview { min-height: 160px; padding: 12px 14px; border-top: 0; }

/* « Ces sujets existent peut-être déjà » */
.similar-box { background: var(--info-soft); border-radius: var(--radius-sm); padding: 10px 14px; }
.similar-box p { margin: 0 0 6px; }
.similar-list { margin: 0; padding-inline-start: 18px; }

/* Contenu des messages (module rendu) */
.post-content h2, .post-content h3, .post-content h4 { margin-top: 1em; }
.post-content table.md-table { border-collapse: collapse; margin: .6em 0; font-size: .95em; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 6px 10px; }
.md-table th { background: var(--surface-2); }
.post-content ul.tasks { list-style: none; padding-inline-start: 4px; }
.post-content li.task input { margin-inline-end: 6px; vertical-align: -3px; }
.post-content del { opacity: .7; }
.post-content img { border-radius: 8px; }
.box { margin: .8em 0; border-radius: var(--radius-sm); border: 1px solid var(--border); border-inline-start: 4px solid var(--primary); background: var(--surface-2); padding: 10px 14px; }
.box-title { margin: 0 0 4px; font-weight: 700; }
.box-body > :first-child { margin-top: 0; }
.box-body > :last-child { margin-bottom: 0; }
.box-attention { border-inline-start-color: var(--danger); background: var(--danger-soft); }
.box-astuce { border-inline-start-color: var(--success); background: var(--success-soft); }
.box-definition, .box-exemple { border-inline-start-color: var(--accent); }
details.box-solution > summary { cursor: pointer; font-weight: 700; color: var(--primary); }
details.box-solution[open] > summary { margin-bottom: 8px; }
.math-display { overflow-x: auto; margin: .6em 0; }

/* Installateur */
.install { max-width: 820px; margin-inline: auto; }
.install-head { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: baseline; }
.stepper { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 8px 0 18px; counter-reset: s; }
.stepper li { display: flex; }
.stepper a, .stepper li > span { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-size: .85rem; }
.stepper-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: .8rem; }
.stepper li.is-done .stepper-n { background: var(--success-soft); color: var(--success); border-color: transparent; }
.stepper li.is-current .stepper-n { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.stepper li.is-current .stepper-l { color: var(--text); font-weight: 700; }
@media (max-width: 639px) { .stepper li:not(.is-current) .stepper-l { display: none; } }
.install-nav { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.table.checks td { padding: 6px 8px; }
.profiles { display: grid; gap: 10px; }
@media (min-width: 640px) { .profiles { grid-template-columns: repeat(3, 1fr); } }
.profile-card { display: flex !important; flex-direction: column; gap: 4px !important; padding: 14px; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.profile-card.is-on { border-color: var(--primary); background: var(--primary-soft); }
.profile-card input { position: absolute; opacity: 0; }
.module-pick { align-items: flex-start !important; padding: 8px 0; border-top: 1px solid var(--border); }

/* Administration */
.admin-nav-group { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px 2px; white-space: nowrap; }
@media (max-width: 899px) { .admin-nav-group { display: none; } }
.welcome-card { border-color: var(--primary); }
.welcome-card ol { margin: 0; padding-inline-start: 20px; }
.kv-wide { grid-template-columns: minmax(120px, max-content) 1fr; }
.code-box { font-family: var(--mono); font-size: .8rem; white-space: pre-wrap; background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); max-height: 420px; overflow: auto; direction: ltr; text-align: left; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.status-dot.is-new { background: var(--danger); }
.status-dot.is-seen { background: var(--accent); }
.status-dot.is-resolved { background: var(--success); }
.lv-error, .lv-fatal { color: var(--danger); }
.lv-warning { color: var(--accent); }

/* Derniers messages (accueil) */
.latest .row { grid-template-columns: 36px 1fr; }
.form label.btn { flex-direction: row; align-items: center; }
.danger-box { border: 1px dashed var(--border) !important; border-radius: var(--radius-sm); padding: 12px 14px !important; }
.danger-box legend { padding: 0 6px !important; }
.lang-table td { vertical-align: top; }
.lang-edit { display: flex; flex-direction: column; gap: 6px; }
.lang-edit textarea { min-height: 42px; }
.lang-table tr.is-missing td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.lang-table tr.is-modified td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.help-link { align-self: flex-end; font-size: .85rem; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.aide-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.aide-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); margin: 0 !important; }
.aide-card:hover { border-color: var(--primary); }
.aide-card img { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--border); }
.aide-hero { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); margin: 4px 0 16px; }
.aide-page .post-content { max-width: 75ch; }

/* Texte des membres dans une autre langue que l'interface (ex. message français sur une page en arabe) :
   chaque paragraphe prend la direction de son propre texte. */
.post-content p, .post-content li, .post-content td, .post-content th, .post-content h2, .post-content h3, .post-content h4,
.post-content blockquote, .row-desc, .breadcrumbs span { unicode-bidi: plaintext; }
.post-content[dir="auto"] { text-align: start; }
