/* DA F « Bloc atelier » (choisie par Narkoo le 28/10) : visuel « Bloc craft » (coins carrés,
   bordures épaisses, ombres franches, vert herbe et or) + polices « Atelier clair ».
   Polices auto-hébergées, servies par Craftdesk à /fonts/ (pas de Google Fonts) : Fraunces (titres) et Inter (texte). */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-4.1-latin.woff2") format("woff2");
}
@font-face {
  font-family: Fraunces;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/fraunces-1.000-latin.woff2") format("woff2");
}

:root {
  --bg: #15171A;
  --panel: #1F2226;
  --line: #34383E;
  --line-2: #3A3F46;
  --line-soft: #2A2E33;
  --text: #F1F1EC;
  --muted: #A9ADB3;
  --accent: #6BCB3F;
  --accent-ink: #10140C;
  --warn: #E7B53C;
  --danger: #FF8A7A;
  --danger-bg: #3D1C1A;
  --hover: #262A2F;
  --selected: #24331C;
  --radius: 4px;
  --radius-small: 3px;
  --bw: 2px;
  --shadow: 0 4px 0 #0A0B0D;
  --shadow-button: 0 3px 0 #0A0B0D;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1, h2, .brand, .editor-title { font-family: Fraunces, Georgia, "Times New Roman", serif; letter-spacing: -0.01em; }
h1 { margin: 0 0 16px; font-size: 28px; font-weight: 700; }
a { color: var(--accent); }

.shell { min-height: 100vh; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.brand { margin: 0 0 6px; color: var(--accent); font-size: 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.auth { display: flex; justify-content: center; padding: 64px 16px; }
.card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

form { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--text); line-height: 1.45; }
label.check input { margin-top: 3px; accent-color: var(--accent); }

input[type=email], input[type=password], input[type=text] {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-small);
  border: var(--bw) solid var(--line-2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input.code { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }

button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: var(--radius-small);
  border: var(--bw) solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-button);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
button:active:not(:disabled), .button:active { transform: translateY(2px); box-shadow: 0 1px 0 #0A0B0D; }
button.ghost, .button.ghost { background: var(--panel); color: var(--text); border: var(--bw) solid var(--line-2); font-weight: 500; }

.notice { margin: 12px 0; padding: 10px 14px; border-radius: var(--radius-small); font-size: 14px; }
.notice.error { background: var(--danger-bg); color: var(--danger); }
.notice.info { background: var(--selected); color: var(--accent); }

.qr { display: flex; justify-content: center; margin: 16px 0 8px; }
.qr svg { width: 200px; height: 200px; border-radius: var(--radius-small); }
code.secret {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-small);
  background: var(--bg);
  border: var(--bw) solid var(--line);
  font-size: 14px;
  letter-spacing: .08em;
  word-break: break-all;
}

.page { max-width: 960px; margin: 0 auto; padding: 32px 16px 48px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.bar form { margin: 0; }
.bar h1 { margin: 0; }

.spaces { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.space {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 18px;
  border-radius: var(--radius);
  border: var(--bw) solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}
.space:hover { border-color: var(--accent); }
.space-title { display: flex; align-items: center; gap: 10px; }
.swatch { flex: 0 0 14px; }
.tag { margin-left: auto; padding: 2px 8px; border-radius: var(--radius-small); border: var(--bw) solid var(--warn); color: var(--warn); font-size: 12px; }

/* Prototype d'appel */
h2 { margin: 28px 0 12px; font-size: 19px; }
.call { max-width: 1200px; }
.call h1 .tag { margin-left: 12px; vertical-align: middle; }
.call-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.call-controls button { width: auto; margin: 0; }
button.danger { background: var(--danger-bg); color: var(--danger); border: var(--bw) solid #5A2D2B; }
.rec-banner { margin: 8px 0 12px; padding: 10px 14px; border-radius: var(--radius-small); background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.rec-banner[hidden] { display: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { position: relative; margin: 0; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius); background: var(--panel); border: var(--bw) solid var(--line); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.screen { grid-column: 1 / -1; cursor: zoom-in; }
.tile.screen video { object-fit: contain; }
.tile.camera { cursor: zoom-in; }
.tile.focus { grid-column: 1 / -1; cursor: zoom-out; border-color: var(--accent); }
.tile figcaption { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--radius-small); background: rgba(21, 23, 26, .8); font-size: 13px; }
.tile.self { border-color: var(--line-2); }

button:disabled { opacity: .45; cursor: not-allowed; }

/* Éditeur de grades (/grades) */
.page.wide { max-width: 1120px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.notice.locked { background: #3A3016; color: var(--warn); line-height: 1.5; }

.grades-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.grade-list {
  flex: 1 1 260px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.grade-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-small);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.grade-item:hover { background: var(--hover); }
.grade-item[aria-current=page] { background: var(--selected); font-weight: 600; }
.grade-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.grade-editor {
  flex: 999 1 480px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.grade-editor form, .grade-editor .grade-form { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.grade-editor .notice { margin: 0 0 16px; }
.editor-title { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 22px; }
.editor-title .tag { margin-left: 4px; font-weight: 400; font-family: Inter, system-ui, sans-serif; }
.editor-title .muted { margin-left: auto; font-weight: 400; font-family: Inter, system-ui, sans-serif; font-size: 15px; }

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.perm-group legend { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.color-row { display: flex; flex-wrap: wrap; gap: 8px; }
.color-choice { position: relative; flex-direction: row; gap: 0; cursor: pointer; }
.color-choice input { position: absolute; opacity: 0; width: 32px; height: 32px; margin: 0; cursor: pointer; }
.swatch-big { display: block; border-radius: var(--radius-small); border: 2px solid transparent; padding: 0; box-sizing: content-box; margin: -2px; }
.color-choice input:checked + .swatch-big { border-color: var(--text); }
.color-choice input:focus-visible + .swatch-big { outline: 2px solid var(--accent); outline-offset: 3px; }
fieldset:disabled .color-choice, fieldset:disabled .color-choice input { cursor: not-allowed; }
fieldset:disabled .swatch-big { opacity: .6; }

.perm {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--text);
  cursor: pointer;
}
.perm-text { display: flex; flex-direction: column; min-width: 0; }
.perm-name { font-size: 14px; font-weight: 500; }
.perm-hint { font-size: 12px; color: var(--muted); }
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 26px;
  margin: 0;
  border-radius: var(--radius-small);
  background: var(--line-2);
  cursor: pointer;
  transition: background .15s;
}
.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 2px;
  background: var(--text);
  transition: transform .15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(20px); background: var(--accent-ink); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch:disabled { cursor: not-allowed; opacity: .6; }
.perm:has(.switch:disabled) { cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: var(--bw) solid var(--line); }
.danger-zone summary { cursor: pointer; color: var(--danger); font-size: 14px; }
.danger-zone form { margin: 8px 0 0; align-items: flex-start; }
.danger-zone p { margin: 8px 0 0; }

/* Centre de fichiers (/espaces/<espace>/fichiers, /fichiers) */
input[type=number], input[type=search], select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-small);
  border: var(--bw) solid var(--line-2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input[type=file] { color: var(--muted); font: inherit; }
input[type=file]::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border-radius: var(--radius-small);
  border: var(--bw) solid var(--line-2);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
input[type=text][readonly] { color: var(--muted); }
input[type=number]:disabled { opacity: .6; cursor: not-allowed; }
.actions-left { margin: 0 0 8px; }

.files-title { display: flex; align-items: center; gap: 12px; }
.files-title h1 { margin: 0; }
.files-title p { margin: 2px 0 0; }
.files-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.files-actions .tool { margin: 0; }
.files-actions .tool[open] { flex: 1 1 360px; }

.tool { margin: 8px 0; }
.tool > summary { cursor: pointer; list-style: none; width: fit-content; }
.tool > summary.button { display: inline-flex; }
.tool > summary::-webkit-details-marker { display: none; }
.tool:not(:has(> summary.button)) > summary { color: var(--accent); font-size: 14px; }
.tool[open] > form, .tool[open] > p, .tool[open] > input { margin-top: 10px; }
.tool[open] form {
  padding: 16px;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.dropzone {
  align-items: center;
  gap: 10px;
  padding: 22px 16px;
  border: var(--bw) dashed var(--line-2);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--accent); }

.page.files { max-width: 1440px; }
.files-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.files-tree {
  flex: 1 1 220px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tree-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 4px 10px;
  border-radius: var(--radius-small);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.tree-item:hover { background: var(--hover); }
.tree-item[aria-current=page] { background: var(--selected); font-weight: 600; }
.tree-item .folder-icon { flex: 0 0 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linejoin: round; }
.tree-item[aria-current=page] .folder-icon { stroke: var(--accent); }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item.d2 { padding-left: 28px; }
.tree-item.d3 { padding-left: 46px; }
.tree-item.d4 { padding-left: 64px; }
.tree-item.d5 { padding-left: 82px; }
.tree-item.d6 { padding-left: 100px; }
.tree-item.d7 { padding-left: 118px; }
.tree-item.d8 { padding-left: 136px; }
.tree-item.d9 { padding-left: 154px; }
.tree-foot { margin-top: 12px; padding: 12px 10px 4px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.tree-foot .tree-item { padding-left: 0; }
.quota-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
progress.quota { width: 100%; height: 8px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 2px; background: var(--line-2); overflow: hidden; }
progress.quota::-webkit-progress-bar { background: var(--line-2); }
progress.quota::-webkit-progress-value { background: var(--accent); }
progress.quota::-moz-progress-bar { background: var(--accent); }

.files-main { flex: 999 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.crumb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.crumbs { flex: 1 1 240px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs strong { color: var(--text); }
.search { display: flex; gap: 8px; margin: 0; flex: 0 1 320px; flex-direction: row; }
.search input { min-width: 0; }
.search button { min-height: 42px; padding: 6px 14px; }
.folder-tools { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.folder-tools .tool { margin: 0; }
.files-subtitle { margin: 4px 0 0; }

.file-table { background: var(--panel); border: var(--bw) solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.file-head, .file-row {
  display: grid;
  grid-template-columns: minmax(200px, 2.4fr) 90px minmax(100px, 1.2fr) 100px;
  gap: 12px;
  align-items: center;
  min-width: 560px;
  padding: 0 16px;
}
.file-head { padding-top: 10px; padding-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: var(--bw) solid var(--line); }
.file-row { min-height: 48px; border-bottom: 1px solid var(--line-soft); color: var(--text); text-decoration: none; font-size: 14px; }
a.file-row:hover { background: var(--hover); }
.trash-row { grid-template-columns: minmax(200px, 2fr) minmax(160px, 2fr) 130px auto; }
.trash-row form { margin: 0; flex-direction: row; }
.file-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 20px 16px; margin: 0; }

.kind { flex: 0 0 38px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 2px; font-size: 10px; font-weight: 700; background: #2A2E33; color: var(--muted); }
.kind-img { background: #22351A; color: #8EE05F; }
.kind-zip { background: #3A3016; color: #F2C94C; }
.kind-doc { background: #3D1C1A; color: #FF8A7A; }
.kind-media { background: #1B2B3D; color: #7FB8FF; }
.kind-code { background: #2B2342; color: #B7A9FF; }
.kind-folder { background: #3A3016; color: var(--warn); }

.tag-pill { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 1px 8px; border-radius: var(--radius-small); border: var(--bw) solid var(--line-2); background: var(--bg); font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; }
.tree-item .tag-pill { padding: 0 6px; font-size: 11px; }

.file-detail { flex: 1 1 290px; max-width: 360px; display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--panel); border: var(--bw) solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
@media (max-width: 1100px) { .file-detail { max-width: 100%; } }
.file-detail form { margin: 0; }
.detail-chip { width: 100%; height: 120px; border-radius: var(--radius-small); font-family: Fraunces, Georgia, serif; font-size: 30px; font-weight: 700; }
.detail-title { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.detail-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.versions h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-family: Inter, system-ui, sans-serif; }
.version-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 36px; padding: 4px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.version-label { font-weight: 600; }
.version-label.current { color: #8EE05F; }
.version-row .muted { flex: 1 1 140px; }
.small-button { min-height: 30px; padding: 3px 10px; font-size: 12px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.link-danger { align-self: flex-start; min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; color: var(--danger); font-size: 13px; font-weight: 400; }

/* Profil (/profil, /membres/<id>) : couleurs et bannières en classes, jamais en style en ligne (CSP). */
/* Couleur par défaut posée une seule fois ici : un défaut sur .profile-card ou .choice écraserait les classes .pc-*. */
:root { --pc: var(--accent); }
.pc-herbe { --pc: #6BCB3F; }
.pc-or { --pc: #E7B53C; }
.pc-ciel { --pc: #5AB0F0; }
.pc-amethyste { --pc: #A98BFF; }
.pc-redstone { --pc: #FF5C5C; }
.pc-cuivre { --pc: #D9895B; }
.pc-prismarine { --pc: #4FC9B0; }
.pc-neige { --pc: #E8EEF2; }

.banner-the-rise { background: linear-gradient(135deg, #22351A 0%, #1B2B3D 100%); }
.banner-maniasky { background: linear-gradient(135deg, #1B2B3D 0%, #2B2342 100%); }
.banner-nether { background: linear-gradient(135deg, #3D1C1A 0%, #3A3016 100%); }
.banner-plain { background: #262A2F; }

.status-dot { display: inline-block; flex: 0 0 12px; width: 12px; height: 12px; border-radius: 2px; background: #5A5F66; }
.status-online { background: #6BCB3F; }
.status-away { background: #E7B53C; }
.status-dnd { background: #FF6B5E; }
.status-invisible, .status-offline { background: #5A5F66; }

.profile-card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  min-height: 170px;
  margin: 0 0 22px;
  padding: 24px;
  border: var(--bw) solid var(--pc);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pc-avatar {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  border: 3px solid var(--pc);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.pc-avatar-img { display: block; width: 90px; height: 90px; image-rendering: pixelated; }
.pc-avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--pc);
  color: var(--accent-ink);
  font-family: Fraunces, Georgia, serif;
  font-size: 40px;
  font-weight: 700;
}
.pc-avatar .status-dot { position: absolute; right: -8px; bottom: -8px; width: 20px; height: 20px; border: 3px solid var(--bg); }
.pc-body { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pc-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-small);
  background: var(--bg);
  border: 1px solid var(--line-2);
  font-size: 12px;
  font-weight: 700;
}
.chip-title { color: var(--pc); }
.pc-name { margin: 0; font-size: 34px; line-height: 1.1; overflow-wrap: anywhere; }
.pc-line { margin: 0; font-size: 14px; color: #DADBD4; }
.pc-bio { margin: 0; max-width: 620px; font-size: 14px; color: #DADBD4; white-space: pre-line; overflow-wrap: anywhere; }
.pc-meta { margin: 0; font-size: 13px; color: var(--muted); }
.pc-meta strong { color: var(--text); }
.pc-links { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pc-links a {
  display: inline-block;
  padding: 4px 12px;
  border: var(--bw) solid var(--pc);
  border-radius: var(--radius-small);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.pc-links a:hover { background: var(--hover); }

.page.member { max-width: 760px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
form.profile-grid, .profile form { margin: 0; }
.profile .actions { margin-top: 4px; }
.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0; font-size: 19px; }
.panel-sub { margin: 4px 0 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.panel .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.profile > .panel { margin-top: 20px; }
.profile textarea { resize: vertical; }
textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-small);
  border: var(--bw) solid var(--line-2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
textarea:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; flex-direction: row; gap: 0; cursor: pointer; color: var(--text); }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: var(--bw) solid var(--line-2);
  border-radius: var(--radius-small);
  background: var(--bg);
  font-size: 13px;
}
.choice input:checked + .choice-box { border-color: var(--pc); font-weight: 700; background: var(--selected); }
.choice input:focus-visible + .choice-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.banner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.choice-banner .choice-box { flex-direction: column; align-items: stretch; gap: 6px; padding: 0; border: 0; background: transparent; font-size: 12px; text-align: center; }
.banner-sample { display: block; height: 52px; border: 3px solid var(--line-2); border-radius: var(--radius-small); }
.choice-banner input:checked + .choice-box .banner-sample { border-color: var(--text); }
.choice-banner input:checked + .choice-box { background: transparent; }

.secu-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.secu-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.secu-actions form { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .switch, .switch::before { transition: none; }
  button:active:not(:disabled), .button:active { transform: none; }
}

/* Notifications et annonces (/notifications, /espaces/<espace>/annonces) */
.top-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.top-tools form { margin: 0; }
.bell { position: relative; }
.badge {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  border-radius: var(--radius-small);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.notice.warn { background: #3A3016; color: var(--warn); }

.notif-list { grid-template-columns: 1fr; gap: 10px; }
.notif .space-title strong { font-weight: 500; overflow-wrap: anywhere; }
.notif-unread { border-color: var(--accent); background: var(--selected); }
.notif-unread .space-title strong { font-weight: 700; }
.unread-mark { color: var(--accent); font-weight: 700; }

.announce-actions { margin: 0 0 20px; }
.announcements { display: flex; flex-direction: column; gap: 16px; }
.announcement { gap: 10px; }
.announcement.pinned { border-color: var(--warn); }
.announcement-title { margin: 0; font-size: 21px; overflow-wrap: anywhere; }
.announcement p { margin: 0; }
.announcement-body { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.55; }
.announcement-tools { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 16px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.announcement-tools > form { margin: 0; }
.announcement-tools .tool { margin: 0; }
.announcement-tools .tool[open] { flex: 1 1 100%; }
.announcement-tools .danger-zone { margin: 0; padding-top: 0; border-top: 0; }
.mention { color: var(--accent); font-weight: 600; text-decoration: none; }
a.mention:hover { text-decoration: underline; }
.mention-team { color: var(--warn); }
.mention-everyone { text-decoration: underline; }

/* Chat des espaces et messages privés (/espaces/<espace>/chat, /chat, /messages) : salons à gauche, fil au centre, saisie en bas.
   Les valeurs par défaut des variables restent sur :root ; ici on ne réutilise que les variables existantes. */
.notice[hidden] { display: none; }
.dm-banner { margin-top: 0; }
.chat-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.chat-side { flex: 1 1 240px; max-width: 300px; display: flex; flex-direction: column; gap: 12px; }
.chat-channels {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.chat-channels .grade-item .badge { margin-left: auto; }
.chat-channels .grade-item .tag { margin-left: auto; }
.conv-name { display: flex; flex-direction: column; }
.conv-title, .conv-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-tools { display: flex; flex-direction: column; gap: 4px; }
.chat-tools .tool { margin: 0; }
.chat-main {
  flex: 999 1 460px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: var(--panel);
  border: var(--bw) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.chat-title { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-size: 21px; overflow-wrap: anywhere; }
.chat-title .tag { margin-left: auto; font-family: Inter, system-ui, sans-serif; font-weight: 400; }
.chat { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chat-older { margin: 0; }
.chat-feed { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.empty-feed { margin: 8px 0; }

.msg-group { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.msg-group:first-child { border-top: 0; padding-top: 0; }
.msg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 2px; }
.msg-avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: var(--radius-small); border: 2px solid var(--line-2); background: var(--bg); image-rendering: pixelated; }
.msg-initial { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: 18px; }
.msg-name { color: var(--text); font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
a.msg-name:hover { text-decoration: underline; }
.chat-title .msg-avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: 16px; }

.msg { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 2px 46px; min-width: 0; }
.msg:target { background: var(--selected); border-radius: var(--radius-small); }
.msg p { margin: 0; }
.msg-text { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.5; }
.msg-edited { color: var(--muted); font-size: 12px; }
.msg-struck { text-decoration: line-through; color: var(--muted); }
.msg-hidden { color: var(--warn); font-style: italic; }
.msg-tools { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px 14px; font-size: 13px; }
.msg-tools form { margin: 0; }
.msg-tools .msg-tool { margin: 0; }
.msg-tools .msg-tool[open] { flex: 1 1 100%; }
.msg-tools .link-danger { font-size: 12px; }
.msg-notice { margin: 0; padding: 6px 12px; border-left: 3px solid var(--warn); background: #3A3016; color: var(--warn); font-size: 13px; }

.chat-form { margin: 8px 0 0; padding-top: 12px; border-top: var(--bw) solid var(--line); }
.chat-form textarea { resize: vertical; min-height: 76px; }
.chat-form-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.chat-form-row .perm-hint { flex: 1 1 260px; }
