/* Mon espace — habillage aligné sur l’accueil (terre cuite, encre, tuiles pêche, sable et lilas).
   Présentation seulement : le balisage, les textes, les états et les actions restent ceux de
   lib/community-client/participant-space.js. Les couleurs viennent des jetons --racines-*
   de home-simplified.css, ce qui donne le mode sombre sans règle supplémentaire.
   « #main #screen-mine » l’emporte sur les couches précédentes (refonte, refonte-espaces,
   participant-redesign) sans !important. */

#main #screen-mine {
  --esp-ink: var(--racines-ink, #302d35);
  --esp-muted: var(--racines-muted, #655d65);
  --esp-line: var(--racines-line, #e4dcd8);
  --esp-paper: var(--racines-paper, #faf9f6);
  --esp-card: #fff;
  --esp-clay: #b64939;
  --esp-clay-hover: #9d3b2d;
  --esp-clay-ink: #fffaf8;
  --esp-berry: var(--racines-berry, #ae3461);
  --esp-peach: var(--racines-peach, #f5dfd1);
  --esp-clay-tile: #fae9e1; --esp-clay-edge: #e9c8ba; --esp-clay-icon: #934b42;
  --esp-sand-tile: #fcf1dd; --esp-sand-edge: #e7d5af; --esp-sand-icon: #895c27;
  --esp-lilac-tile: #f1eaf6; --esp-lilac-edge: #ddcfe7; --esp-lilac-icon: #704a85;
  --esp-shadow: 0 1px 2px #302d350a, 0 10px 28px -18px #302d3533;
  --esp-shadow-hover: 0 1px 2px #302d350f, 0 16px 34px -18px #302d3547;
  --space-ink: var(--esp-ink); --space-muted: var(--esp-muted); --space-rule: var(--esp-line);
  max-width: 1240px;
  padding: clamp(26px, 3.4vw, 46px) clamp(20px, 4vw, 56px) 52px;
  color: var(--esp-ink);
}
html[data-theme="dark"] #main #screen-mine {
  --esp-card: #2e2a2e;
  --esp-clay: #d98671; --esp-clay-hover: #e79c88; --esp-clay-ink: #2b1a16;
  --esp-clay-tile: #3b2c2b; --esp-clay-edge: #63443e; --esp-clay-icon: #e7ad99;
  --esp-sand-tile: #352f27; --esp-sand-edge: #5e4f38; --esp-sand-icon: #e6c18a;
  --esp-lilac-tile: #352d3d; --esp-lilac-edge: #564760; --esp-lilac-icon: #d4b6e2;
  --esp-shadow: 0 10px 28px -18px #0009; --esp-shadow-hover: 0 16px 34px -18px #000b;
}

/* Titres et textes : l’encre du site, plus de vert. */
#main #screen-mine :is(h1, h2, h3, h4) { color: var(--esp-ink); }
#main #screen-mine > .eyebrow { color: var(--esp-clay); letter-spacing: .14em; margin-bottom: 6px; }
#main #screen-mine > h1 {
  color: var(--esp-ink); font: 700 clamp(34px, 4.4vw, 58px)/1.04 var(--font-ui);
  letter-spacing: -.058em; margin: 0 0 clamp(18px, 2.4vw, 30px);
}
#main #screen-mine .space-kicker { color: var(--esp-muted); letter-spacing: .12em; }
#main #screen-mine :is(.muted, .form-help, .space-record-meta, .space-status-help, .space-section-title p) { color: var(--esp-muted); }
#main #screen-mine :is(.participant-space, .space-welcome, .space-priority, .space-section-title, .space-bottom) { color: var(--esp-ink); }
#main #screen-mine a:not(.button):not(.space-shortcut) { text-decoration-color: color-mix(in srgb, var(--esp-clay) 55%, transparent); text-underline-offset: 3px; }
#main #screen-mine :is(button, a, summary, input, select, textarea):focus-visible { outline: 3px solid var(--esp-clay); outline-offset: 3px; }

/* Boutons : pilules comme l’accueil. Terre cuite pour l’action principale, encre pour la gestion. */
#main #screen-mine .button {
  min-height: 46px; padding: 11px 20px; border-radius: 999px; font-weight: 700; font-size: 14px;
  transition: background-color .16s, border-color .16s, color .16s, box-shadow .16s, transform .16s;
}
#main #screen-mine .button.green { background: var(--esp-clay); border-color: var(--esp-clay); color: var(--esp-clay-ink); }
#main #screen-mine .button.coral { background: var(--esp-berry); border-color: var(--esp-berry); color: var(--racines-action-ink, #fffaf8); }
#main #screen-mine .button.violet { background: var(--esp-ink); border-color: var(--esp-ink); color: var(--esp-paper); }
#main #screen-mine .button.outline { background: var(--esp-card); border-color: var(--esp-line); color: var(--esp-ink); }
#main #screen-mine .text-button { color: var(--esp-ink); font-weight: 700; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--esp-clay) 50%, transparent); text-underline-offset: 4px; }
@media (hover: hover) {
  #main #screen-mine .button.green:hover:not(:disabled) { background: var(--esp-clay-hover); border-color: var(--esp-clay-hover); }
  #main #screen-mine .button.coral:hover:not(:disabled) { filter: brightness(.92); }
  #main #screen-mine .button.violet:hover:not(:disabled) { filter: brightness(1.25); }
  #main #screen-mine .button.outline:hover:not(:disabled) { background: var(--esp-paper); border-color: var(--esp-clay-icon); }
  #main #screen-mine .button:hover:not(:disabled) { box-shadow: var(--esp-shadow); }
  #main #screen-mine .text-button:hover { color: var(--esp-clay); text-decoration-color: currentColor; }
}

/* Accueil de l’espace : une tuile pêche, comme les tuiles de l’accueil, avec un léger relief. */
#main #screen-mine .participant-space .space-welcome {
  position: relative; overflow: hidden; gap: clamp(18px, 3vw, 40px);
  padding: clamp(24px, 3vw, 38px) clamp(22px, 3.2vw, 42px);
  border: 1px solid var(--esp-clay-edge); border-radius: 27px;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--esp-peach) 85%, transparent) 0%, transparent 55%),
    var(--esp-clay-tile);
  box-shadow: none;
}
#main #screen-mine .participant-space .space-welcome::after {
  content: ''; position: absolute; right: -60px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%;
  border: 38px solid var(--esp-clay); opacity: .07; pointer-events: none;
}
#main #screen-mine .participant-space .space-welcome > * { position: relative; z-index: 1; }
/* Le bandeau suit désormais les rubriques et n’apparaît que dans « Accueil ». */
#main #screen-mine .participant-space .space-nav + .space-welcome { margin: 0 0 26px; }
#main #screen-mine .space-welcome .space-kicker { color: var(--esp-clay-icon); }
#main #screen-mine .participant-space .space-welcome h2 {
  color: var(--esp-ink); font-size: clamp(26px, 3vw, 40px); font-weight: 700; letter-spacing: -.055em; line-height: 1.08; margin: 0 0 12px;
}
#main #screen-mine .participant-space .space-welcome p:not(.space-kicker) { color: var(--esp-muted); font-size: 15px; }
#main #screen-mine .space-welcome .button { background: var(--esp-clay); border-color: var(--esp-clay); color: var(--esp-clay-ink); min-height: 50px; font-size: 15px; padding-inline: 24px; }
#main #screen-mine .space-welcome .button:hover { background: var(--esp-clay-hover); border-color: var(--esp-clay-hover); }
#main #screen-mine .space-welcome-actions { align-items: center; gap: 4px; }
#main #screen-mine .space-private-label {
  margin-top: 16px; padding: 5px 11px 5px 9px; border-radius: 99px;
  background: color-mix(in srgb, var(--esp-card) 70%, transparent); color: var(--esp-muted); font-size: 12px; font-weight: 600;
}
#main #screen-mine .space-test { border: 1px solid var(--esp-lilac-edge); background: var(--esp-lilac-tile); color: var(--esp-ink); border-radius: 16px; }

/* Rubriques : une barre de pilules sur une ligne, défilable sur petit écran, collée en haut au défilement. */
#main #screen-mine .participant-space .space-nav {
  position: sticky; top: 8px; z-index: 5;
  display: flex; flex-wrap: nowrap; gap: 2px; margin: 20px 0 30px; padding: 5px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none;
  border: 1px solid var(--esp-line); border-radius: 999px;
  background: color-mix(in srgb, var(--esp-paper) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: var(--esp-shadow);
}
#main #screen-mine .participant-space .space-nav::-webkit-scrollbar { display: none; }
#main #screen-mine .participant-space .space-nav button {
  flex: 1 0 auto; flex-direction: row; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; min-width: 0; padding: 8px 15px; scroll-snap-align: start;
  border: 0; border-radius: 999px; background: transparent; box-shadow: none;
  color: var(--esp-muted); text-align: center; white-space: nowrap;
}
#main #screen-mine .participant-space .space-nav .space-nav-icon { color: inherit; }
#main #screen-mine .participant-space .space-nav .space-nav-icon svg { width: 18px; height: 18px; }
#main #screen-mine .participant-space .space-nav-label b { font-size: 14px; font-weight: 650; line-height: 1.2; display: inline-flex; align-items: center; }
#main #screen-mine .participant-space .space-nav-label small { display: none; }
#main #screen-mine .participant-space .space-nav button[aria-pressed='true'] {
  background: var(--esp-ink); color: var(--esp-paper); box-shadow: 0 6px 16px -8px #302d3580;
}
#main #screen-mine .participant-space .space-nav button[aria-pressed='true'] :is(.space-nav-icon, small) { color: inherit; }
#main #screen-mine .space-count { background: var(--esp-clay); color: var(--esp-clay-ink) !important; margin-left: 6px; }
@media (hover: hover) {
  #main #screen-mine .participant-space .space-nav button:not([aria-pressed='true']):hover { background: var(--esp-clay-tile); color: var(--esp-ink); }
}
/* Écrans moyens : les libellés seuls tiennent sur une ligne. */
@media (min-width: 761px) and (max-width: 1260px) {
  #main #screen-mine .participant-space .space-nav button { padding-inline: 12px; gap: 0; }
  #main #screen-mine .participant-space .space-nav .space-nav-icon { display: none; }
  #main #screen-mine .participant-space .space-nav-label b { font-size: 13.5px; }
}
/* Entre les deux : icônes gardées, espacement resserré pour que les huit rubriques (et une pastille) tiennent aussi en néerlandais. */
@media (min-width: 1261px) and (max-width: 1400px) {
  #main #screen-mine .participant-space .space-nav button { padding-inline: 9px; gap: 6px; }
}
#main #screen-mine #space-panel { scroll-margin-top: 90px; animation: esp-panel-in .28s ease-out both; }
@keyframes esp-panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Priorité du moment : la prochaine étape, en grand. */
#main #screen-mine .space-priority {
  gap: clamp(18px, 3vw, 36px); padding: clamp(24px, 3vw, 34px) clamp(22px, 3vw, 36px); margin: 0 0 26px;
  border: 1px solid var(--esp-line); border-radius: 24px; background: var(--esp-card); box-shadow: var(--esp-shadow);
  border-left: 6px solid var(--esp-clay);
}
#main #screen-mine .space-priority.needs-attention { background: var(--esp-sand-tile); border-color: var(--esp-sand-edge); border-left-color: var(--esp-sand-icon); }
#main #screen-mine .space-priority .space-kicker { color: var(--esp-clay); }
#main #screen-mine .space-priority.needs-attention .space-kicker { color: var(--esp-sand-icon); }
#main #screen-mine .space-priority :is(h2, h3) { font-size: clamp(23px, 2.6vw, 31px); font-weight: 700; letter-spacing: -.05em; margin: 2px 0 8px; }
#main #screen-mine .space-priority p:not(.space-kicker) { color: var(--esp-muted); font-size: 15px; }
#main #screen-mine .space-priority-actions { gap: 8px; min-width: 210px; }

/* Chiffres : grands nombres terre cuite, comme le compteur de l’accueil. */
#main #screen-mine .space-metric {
  border: 1px solid var(--esp-clay-edge); border-radius: 21px; background: var(--esp-clay-tile); color: var(--esp-ink);
  padding: 20px 22px; transition: border-color .16s, box-shadow .16s;
}
#main #screen-mine .space-metric > span { color: var(--esp-clay-icon); font-size: clamp(38px, 3.6vw, 48px); font-weight: 735; letter-spacing: -.07em; }
#main #screen-mine .space-metric.sun { background: var(--esp-sand-tile); border-color: var(--esp-sand-edge); }
#main #screen-mine .space-metric.sun > span { color: var(--esp-sand-icon); }
#main #screen-mine .space-metric.green { background: var(--esp-lilac-tile); border-color: var(--esp-lilac-edge); }
#main #screen-mine .space-metric.green > span { color: var(--esp-lilac-icon); }
#main #screen-mine .space-metric small { color: var(--esp-muted); }
@media (hover: hover) { #main #screen-mine button.space-metric:hover { box-shadow: var(--esp-shadow-hover); border-color: var(--esp-clay-icon); } }

/* Titres de section et cartes. */
#main #screen-mine .space-section-title :is(h2, h3) { font-size: clamp(23px, 2.3vw, 29px); font-weight: 700; letter-spacing: -.05em; }
#main #screen-mine .space-overview-grid { gap: clamp(18px, 2.4vw, 30px); }
#main #screen-mine :is(.space-recent-card, .space-record, .space-type-card, .space-setting, .space-overview-details, .saved-draft, .space-empty, .space-registration-card, .space-profile) {
  border: 1px solid var(--esp-line); border-radius: 22px; background: var(--esp-card); color: var(--esp-ink); box-shadow: var(--esp-shadow);
}
#main #screen-mine :is(.space-recent-card, .space-record, .space-registration-card) { transition: box-shadow .18s, border-color .18s, transform .18s; }
@media (hover: hover) {
  #main #screen-mine :is(.space-recent-card, .space-registration-card):hover { box-shadow: var(--esp-shadow-hover); border-color: var(--esp-clay-edge); transform: translateY(-1px); }
}
#main #screen-mine :is(.space-recent-card, .space-record) h3 { font-weight: 700; letter-spacing: -.04em; }
#main #screen-mine .space-empty { background: var(--esp-card); border-style: dashed; border-color: var(--esp-clay-edge); box-shadow: none; }
#main #screen-mine :is(.space-empty, .space-help-card) > span:first-child { background: var(--esp-peach); color: var(--esp-clay-icon); border-radius: 12px; }

/* Encadrés d’accompagnement : une tuile par intention, comme sur l’accueil. */
#main #screen-mine .space-quick-actions { border: 1px solid var(--esp-lilac-edge); border-radius: 24px; background: var(--esp-lilac-tile); box-shadow: none; }
#main #screen-mine .space-quick-actions .space-kicker { color: var(--esp-lilac-icon); }
#main #screen-mine .space-shortcut {
  min-height: 62px; border: 1px solid color-mix(in srgb, var(--esp-lilac-edge) 80%, transparent); border-radius: 16px;
  background: var(--esp-card); color: var(--esp-ink); transition: border-color .16s, box-shadow .16s, transform .16s;
}
#main #screen-mine .space-shortcut > span:first-child:not(:only-child) { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--esp-lilac-tile); color: var(--esp-lilac-icon); }
#main #screen-mine .space-shortcut > span:first-child svg { width: 19px; height: 19px; }
#main #screen-mine .space-shortcut small { color: var(--esp-muted); }
@media (hover: hover) { #main #screen-mine .space-shortcut:hover { border-color: var(--esp-lilac-icon); box-shadow: var(--esp-shadow); transform: translateX(2px); } }
#main #screen-mine .space-help-card { border: 1px solid var(--esp-sand-edge); border-radius: 24px; background: var(--esp-sand-tile); color: var(--esp-ink); }
#main #screen-mine .space-help-card > span:first-child { background: color-mix(in srgb, var(--esp-sand-icon) 16%, transparent); color: var(--esp-sand-icon); }
#main #screen-mine .space-help-card h3 { font-weight: 700; letter-spacing: -.045em; }
#main #screen-mine :is(.space-upcoming, .exchange-overview) { border: 1px solid var(--esp-lilac-edge); border-radius: 24px; background: var(--esp-lilac-tile); color: var(--esp-ink); box-shadow: none; }
#main #screen-mine .space-plant-followup { border: 1px solid var(--esp-clay-edge); border-radius: 24px; background: var(--esp-clay-tile); color: var(--esp-ink); }
#main #screen-mine :is(.space-upcoming, .exchange-overview, .space-plant-followup) :is(h2, h3) { font-weight: 700; letter-spacing: -.045em; }

/* Fiches : outils de recherche et filtres sur papier, sélection en encre. */
#main #screen-mine .space-type-card { box-shadow: none; transition: border-color .16s, background-color .16s; }
#main #screen-mine .space-type-card:is([aria-pressed='true'], [aria-current='true']) { background: var(--esp-clay-tile); border-color: var(--esp-clay); box-shadow: inset 0 0 0 1px var(--esp-clay); }
@media (hover: hover) { #main #screen-mine .space-type-card:hover { background: var(--esp-clay-tile); border-color: var(--esp-clay-edge); } }
#main #screen-mine .space-type-card small { color: var(--esp-muted); }
#main #screen-mine .space-record-tools { border: 1px solid var(--esp-line); border-radius: 24px; background: color-mix(in srgb, var(--esp-peach) 28%, var(--esp-paper)); }
#main #screen-mine .space-search { color: var(--esp-ink); }
#main #screen-mine .space-search input { border: 1px solid var(--esp-line); border-radius: 999px; padding-inline: 20px; background: var(--esp-card); color: var(--esp-ink); }
#main #screen-mine .space-search input::placeholder { color: var(--esp-muted); }
#main #screen-mine .space-filters button { border: 1px solid var(--esp-line); border-radius: 999px; background: var(--esp-card); color: var(--esp-ink); padding-inline: 16px; }
#main #screen-mine .space-filters button[aria-pressed='true'] { background: var(--esp-ink); border-color: var(--esp-ink); color: var(--esp-paper); box-shadow: none; }
#main #screen-mine .space-record { padding: 22px 24px; }
#main #screen-mine .space-record > header { gap: 16px; }
#main #screen-mine :is(.space-details, .space-overview-details) > summary { font-weight: 700; color: var(--esp-ink); }
#main #screen-mine .space-details > summary::marker { color: var(--esp-clay); }
#main #screen-mine .space-badge { border-radius: 999px; font-weight: 700; }
/* Une validation ordinaire : un encadré discret ; les corrections et refus gardent l’encadré coloré. */
#main #screen-mine .space-record .notice.space-review.is-approved {
  padding: 12px 16px; margin: 14px 0; border: 1px solid var(--esp-line); border-radius: 16px;
  background: color-mix(in srgb, var(--esp-paper) 70%, var(--esp-card)); box-shadow: none;
}
#main #screen-mine .space-record .notice.space-review.is-approved p { margin: 4px 0; }
#main #screen-mine .space-record .notice.space-review.is-approved .space-details { margin-top: 8px; padding-top: 0; }
#main #screen-mine .space-record .notice.space-review.is-approved .space-details > summary { min-height: 40px; padding: 10px 0 6px; }

/* Compte et profil : réglages en cartes papier, quelques tuiles de couleur pour orienter. */
#main #screen-mine .space-setting { padding: clamp(20px, 2.4vw, 28px); }
#main #screen-mine .space-setting-grid > .space-setting:nth-child(2) { background: var(--esp-clay-tile); border-color: var(--esp-clay-edge); box-shadow: none; }
#main #screen-mine .space-setting-grid > .space-setting:nth-child(3) { background: var(--esp-lilac-tile); border-color: var(--esp-lilac-edge); box-shadow: none; }
#main #screen-mine .space-setting-grid > .space-setting:nth-child(4) { background: var(--esp-sand-tile); border-color: var(--esp-sand-edge); box-shadow: none; }
#main #screen-mine .space-setting h3 { font-weight: 700; letter-spacing: -.045em; }
#main #screen-mine .space-profile h2 { color: var(--esp-ink); font-weight: 700; letter-spacing: -.05em; }
#main #screen-mine .space-profile-preview { background: var(--esp-clay-tile); border-color: var(--esp-clay-edge); border-radius: 20px; }
#main #screen-mine .space-profile-avatar { background: var(--esp-peach); color: var(--esp-clay-icon); }
#main #screen-mine .space-profile :is(input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea) { border-color: var(--esp-line); border-radius: 14px; background: var(--esp-card); color: var(--esp-ink); }

/* Bas de page de l’espace. */
#main #screen-mine .space-bottom { border-top: 1px solid var(--esp-line); color: var(--esp-muted); }
#main #screen-mine #mine-nearby :is(a, button, .direct-entry) { border-color: var(--esp-sand-edge); background: var(--esp-sand-tile); color: var(--esp-ink); border-radius: 22px; }

/* Mes échanges : conversations dans la page, fils des chantiers en bulles, compteurs de non-lus. */
#main #screen-mine .space-count[hidden], #main #screen-mine [data-direct-summary][hidden] { display: none; }
#main #screen-mine .space-direct-summary { display: inline-block; margin: 10px 0 0; padding: 4px 12px; border-radius: 999px; background: var(--esp-clay); color: var(--esp-clay-ink); font-size: 13px; font-weight: 700; }
#main #screen-mine .space-exchange-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 26px; }
#main #screen-mine .space-exchange-jump button {
  display: inline-flex; align-items: center; gap: 2px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--esp-line); border-radius: 999px;
  background: var(--esp-card); color: var(--esp-ink); font: inherit; font-size: 14px; font-weight: 650; cursor: pointer;
}
#main #screen-mine .space-exchange-jump .space-jump-count { margin-left: 6px; color: var(--esp-muted); font-weight: 600; }
@media (hover: hover) { #main #screen-mine .space-exchange-jump button:hover { border-color: var(--esp-clay-edge); background: var(--esp-clay-tile); } }
#main #screen-mine :is(.space-conversations, .space-private-messages, .space-exchange-follows) { scroll-margin-top: 90px; }
#main #screen-mine :is(.space-conversations, .space-private-messages) { margin: 0 0 34px; padding: clamp(20px, 2.6vw, 30px); border: 1px solid var(--esp-line); border-radius: 24px; background: var(--esp-card); box-shadow: var(--esp-shadow); }
#main #screen-mine :is(.space-conversations, .space-private-messages) .space-section-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px 24px; margin-bottom: 18px; }
#main #screen-mine :is(.space-conversations, .space-private-messages, .exchange-space-heading) h3 { margin: 2px 0 6px; font-size: clamp(21px, 2.2vw, 26px); font-weight: 700; letter-spacing: -.045em; }
#main #screen-mine :is(.space-conversations, .space-private-messages) .space-section-title p { margin: 0; max-width: 60ch; }
#main #screen-mine .space-conversation-tools { display: flex; flex-wrap: wrap; gap: 10px; }
#main #screen-mine .space-conversation-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#main #screen-mine .space-conversation {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 12px 16px;
  border: 1px solid var(--esp-line); border-radius: 18px; background: var(--esp-paper); color: var(--esp-ink); font: inherit; text-align: left; cursor: pointer;
  transition: border-color .16s, background-color .16s, box-shadow .16s;
}
#main #screen-mine .space-conversation.is-unread { border-color: var(--esp-clay-edge); background: var(--esp-clay-tile); }
@media (hover: hover) { #main #screen-mine .space-conversation:hover { border-color: var(--esp-clay); box-shadow: var(--esp-shadow); } }
#main #screen-mine .space-conversation-avatar { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--esp-peach); color: var(--esp-clay-icon); font-weight: 800; font-size: 18px; }
#main #screen-mine .space-conversation-body { display: grid; gap: 2px; min-width: 0; }
#main #screen-mine .space-conversation-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
#main #screen-mine .space-conversation-top b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#main #screen-mine .space-conversation-top time { flex: none; color: var(--esp-muted); font-size: 13px; }
#main #screen-mine .space-conversation-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--esp-muted); font-size: 14.5px; }
#main #screen-mine .space-conversation.is-unread .space-conversation-preview { color: var(--esp-ink); font-weight: 600; }
#main #screen-mine .space-conversation-state { justify-self: start; margin-top: 3px; padding: 1px 9px; border-radius: 999px; background: var(--esp-lilac-tile); color: var(--esp-lilac-icon); font-size: 12px; font-weight: 700; }
#main #screen-mine .space-conversation-badge { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--esp-clay); color: var(--esp-clay-ink); font-size: 13px; font-weight: 800; }
#main #screen-mine .space-conversation-badge.is-request { font-size: 12px; }
#main #screen-mine :is(.space-conversation-welcome, .space-conversation-empty) { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 18px 20px; border: 1px dashed var(--esp-clay-edge); border-radius: 18px; background: var(--esp-clay-tile); }
#main #screen-mine :is(.space-conversation-welcome, .space-conversation-empty) p { margin: 4px 0 0; color: var(--esp-muted); max-width: 62ch; }
#main #screen-mine .space-exchange-counts { color: var(--esp-muted); font-weight: 650; }
#main #screen-mine .space-organizer-threads { display: grid; gap: 16px; }
#main #screen-mine .space-organizer-thread { padding: 18px 20px; border: 1px solid var(--esp-line); border-radius: 20px; background: var(--esp-paper); }
#main #screen-mine .space-organizer-thread > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 18px; }
#main #screen-mine .space-organizer-thread h4 { margin: 2px 0 0; font-size: 18px; font-weight: 700; letter-spacing: -.03em; }
#main #screen-mine .space-bubbles { list-style: none; margin: 14px 0 4px; padding: 0; display: grid; gap: 10px; }
#main #screen-mine .space-bubble { max-width: min(560px, 88%); padding: 10px 14px 12px; border-radius: 18px; border: 1px solid var(--esp-line); background: var(--esp-card); }
#main #screen-mine .space-bubble.is-own { justify-self: end; border-color: var(--esp-clay-edge); background: var(--esp-clay-tile); border-bottom-right-radius: 6px; }
#main #screen-mine .space-bubble.is-other { justify-self: start; border-bottom-left-radius: 6px; }
#main #screen-mine .space-bubble-meta { margin: 0 0 4px; color: var(--esp-muted); font-size: 12.5px; overflow-wrap: anywhere; }
#main #screen-mine .space-bubble-meta b { color: var(--esp-ink); }
#main #screen-mine .space-bubble-text { margin: 0; font-size: 15.5px; line-height: 1.45; }
#main #screen-mine .space-bubble .text-button { display: inline-block; margin-top: 8px; font-size: 14px; }
#main #screen-mine .space-organizer-thread .form-help { margin: 8px 0 0; font-size: 13px; }
#main #screen-mine .space-organizer-thread .space-details { margin-top: 6px; }
#main #screen-mine .space-exchange-follows .exchange-space-heading { margin-top: 6px; }

@media (max-width: 760px) {
  #main #screen-mine { padding: 22px 16px 36px; }
  /* Mes échanges : rangées de conversation compactes et bulles plus larges. */
  #main #screen-mine :is(.space-conversations, .space-private-messages) { padding: 18px 14px; border-radius: 20px; }
  #main #screen-mine .space-conversation-tools { width: 100%; }
  #main #screen-mine .space-conversation-tools .button { flex: 1 1 auto; }
  #main #screen-mine .space-conversation { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; }
  #main #screen-mine .space-conversation-avatar { width: 40px; height: 40px; font-size: 16px; }
  #main #screen-mine .space-organizer-thread { padding: 14px; }
  #main #screen-mine .space-bubble { max-width: 94%; }
  #main #screen-mine .space-exchange-jump { gap: 6px; margin-bottom: 20px; }
  #main #screen-mine .space-exchange-jump button { padding: 6px 12px; font-size: 13px; min-height: 38px; }

  #main #screen-mine .participant-space .space-welcome { border-radius: 22px; }
  #main #screen-mine .participant-space .space-welcome::after { width: 180px; height: 180px; border-width: 28px; right: -70px; bottom: -80px; }
  #main #screen-mine .space-welcome-actions { align-items: stretch; max-width: none; width: 100%; }
  /* Petit écran : les huit rubriques visibles d’un coup, en grille 4 × 2, au lieu d’une barre à faire défiler. */
  #main #screen-mine .participant-space .space-nav {
    position: static; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
    margin: 14px 0 20px; padding: 6px; overflow: visible; border-radius: 22px;
  }
  #main #screen-mine .participant-space .space-nav button {
    grid-column: auto; flex-direction: column; gap: 4px; min-height: 62px; padding: 8px 2px 7px;
    border-radius: 16px; white-space: normal; text-align: center;
  }
  #main #screen-mine .participant-space .space-nav button:nth-last-child(-n+3) { grid-column: auto; }
  #main #screen-mine .participant-space .space-nav .space-nav-icon svg { width: 20px; height: 20px; }
  #main #screen-mine .participant-space .space-nav-label b { font-size: 12px; line-height: 1.15; justify-content: center; flex-wrap: wrap; hyphens: auto; overflow-wrap: anywhere; }
  #main #screen-mine .participant-space .space-nav + .space-welcome { margin-bottom: 20px; }
  /* Chiffres : nombre et libellé seulement, sur une ligne chacun. */
  #main #screen-mine .space-metrics { gap: 8px; margin-bottom: 22px; }
  #main #screen-mine .space-metric { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 12px 12px; border-radius: 18px; }
  #main #screen-mine .space-metric > span { font-size: 34px; line-height: 1; }
  #main #screen-mine .space-metric b { font-size: 13px; line-height: 1.2; padding: 0; }
  #main #screen-mine .space-metric :is(small, i) { display: none; }
  #main #screen-mine .space-priority { border-left-width: 5px; }
  #main #screen-mine .space-priority-actions { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #main #screen-mine #space-panel { animation: none; }
  #main #screen-mine :is(.space-recent-card, .space-registration-card, .space-shortcut) { transition: none; transform: none !important; }
}
@media print {
  #main #screen-mine .participant-space .space-nav { position: static; display: none; }
  #main #screen-mine .participant-space .space-welcome::after { display: none; }
}

/* Fenêtre « Conversation privée » : une messagerie plein cadre.
   En-tête compact, messages qui défilent dans la hauteur disponible, saisie toujours visible en bas.
   Les couleurs suivent l’espace participant (terre cuite, encre, papier) et le mode sombre. */
#dialog.direct-chat-dialog {
  --chat-ink: var(--racines-ink, #302d35); --chat-muted: var(--racines-muted, #655d65); --chat-line: var(--racines-line, #e4dcd8);
  --chat-paper: var(--racines-paper, #faf9f6); --chat-card: #fff; --chat-clay: #b64939; --chat-clay-ink: #fffaf8;
  --chat-tile: #fae9e1; --chat-edge: #e9c8ba; --chat-peach: var(--racines-peach, #f5dfd1); --chat-icon: #934b42;
  display: flex; flex-direction: column; width: min(680px, calc(100vw - 24px)); height: min(820px, calc(var(--dialog-viewport-height, 100dvh) - 24px));
  padding: 0; overflow: hidden; border: 1px solid var(--chat-line); border-radius: 26px; background: var(--chat-card); color: var(--chat-ink);
}
html[data-theme="dark"] #dialog.direct-chat-dialog {
  --chat-card: #2e2a2e; --chat-clay: #d98671; --chat-clay-ink: #2b1a16; --chat-tile: #3b2c2b; --chat-edge: #63443e; --chat-icon: #e7ad99;
}
#dialog.direct-chat-dialog .dialog-bar { display: none; }
/* Pendant la vérification de connexion, le contenu est masqué : la barre et son bouton Fermer restent disponibles. */
#dialog.direct-chat-dialog:has(#direct-session-guard) .dialog-bar { display: flex; }
#dialog.direct-chat-dialog #dialog-body { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
#dialog.direct-chat-dialog #dialog-title { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#dialog.direct-chat-dialog .direct-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#dialog.direct-chat-dialog .direct-chat-head {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--chat-line); background: var(--chat-card);
}
#dialog.direct-chat-dialog .direct-chat-icon {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--chat-ink); font-size: 22px; line-height: 1; cursor: pointer; list-style: none;
}
#dialog.direct-chat-dialog .direct-chat-icon::-webkit-details-marker { display: none; }
#dialog.direct-chat-dialog .direct-chat-icon:hover, #dialog.direct-chat-dialog .direct-chat-more[open] > summary { background: var(--chat-tile); }
#dialog.direct-chat-dialog :is(button, a, summary, textarea):focus-visible { outline: 3px solid var(--chat-clay); outline-offset: 2px; }
#dialog.direct-chat-dialog .direct-chat-avatar { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--chat-peach); color: var(--chat-icon); font-weight: 800; font-size: 17px; }
#dialog.direct-chat-dialog .direct-chat-who { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
#dialog.direct-chat-dialog .direct-chat-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; letter-spacing: -.02em; }
#dialog.direct-chat-dialog .direct-chat-who span { color: var(--chat-muted); font-size: 13px; }
#dialog.direct-chat-dialog .direct-chat-more { position: static; }
#dialog.direct-chat-dialog .direct-chat-menu {
  position: absolute; z-index: 6; top: calc(100% - 4px); right: 12px; width: min(340px, calc(100% - 24px)); max-height: 60vh; overflow: auto;
  padding: 16px 18px; border: 1px solid var(--chat-line); border-radius: 18px; background: var(--chat-card); color: var(--chat-ink);
  box-shadow: 0 18px 40px -16px #302d3555; font-size: 14px; line-height: 1.5;
}
#dialog.direct-chat-dialog .direct-chat-menu p { margin: 0 0 8px; }
#dialog.direct-chat-dialog .direct-chat-menu .text-button { display: block; margin: 12px 0 8px; color: var(--chat-ink); font-weight: 700; }
#dialog.direct-chat-dialog .direct-report summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
#dialog.direct-chat-dialog .direct-report .button { margin-top: 6px; }
#dialog.direct-chat-dialog .direct-chat-note { margin: 0; padding: 7px 16px; border-bottom: 1px solid var(--chat-line); background: var(--chat-paper); color: var(--chat-muted); font-size: 12.5px; text-align: center; }
#dialog.direct-chat-dialog .direct-chat-history {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 3px;
  padding: 14px clamp(12px, 3vw, 22px) 18px; background: var(--chat-paper);
}
#dialog.direct-chat-dialog .direct-chat-history:focus-visible { outline-offset: -3px; }
/* Peu de messages : ils se posent au-dessus de la saisie, comme dans une messagerie. */
#dialog.direct-chat-dialog .direct-chat-history > :first-child { margin-top: auto; }
#dialog.direct-chat-dialog .direct-chat-day { display: flex; justify-content: center; margin: 14px 0 8px; }
#dialog.direct-chat-dialog .direct-chat-day span { padding: 3px 12px; border-radius: 999px; background: var(--chat-card); border: 1px solid var(--chat-line); color: var(--chat-muted); font-size: 12px; font-weight: 600; }
#dialog.direct-chat-dialog .direct-chat-day span::first-letter { text-transform: uppercase; }
#dialog.direct-chat-dialog .direct-chat-msg { display: flex; margin-top: 8px; }
#dialog.direct-chat-dialog .direct-chat-msg.is-grouped { margin-top: 0; }
#dialog.direct-chat-dialog .direct-chat-msg.is-own { justify-content: flex-end; }
#dialog.direct-chat-dialog .direct-chat-bubble {
  max-width: min(78%, 480px); padding: 9px 13px 6px; border-radius: 20px; border: 1px solid var(--chat-line);
  background: var(--chat-card); color: var(--chat-ink); box-shadow: 0 1px 1px #302d3508;
}
#dialog.direct-chat-dialog .is-other .direct-chat-bubble { border-bottom-left-radius: 6px; }
#dialog.direct-chat-dialog .is-own .direct-chat-bubble { border-color: var(--chat-clay); border-bottom-right-radius: 6px; background: var(--chat-clay); color: var(--chat-clay-ink); }
#dialog.direct-chat-dialog .direct-chat-bubble p { margin: 0; font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
#dialog.direct-chat-dialog .direct-chat-meta { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; opacity: .72; font-variant-numeric: tabular-nums; }
#dialog.direct-chat-dialog .direct-chat-seen.is-seen { font-weight: 700; opacity: 1; }
#dialog.direct-chat-dialog .direct-chat-empty { margin: auto; color: var(--chat-muted); text-align: center; }
#dialog.direct-chat-dialog .direct-chat-foot { flex: none; border-top: 1px solid var(--chat-line); background: var(--chat-card); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
#dialog.direct-chat-dialog .direct-chat-line { margin: 0 0 8px; color: var(--chat-muted); font-size: 13px; line-height: 1.45; }
#dialog.direct-chat-dialog .direct-chat-line:last-child { margin-bottom: 0; }
#dialog.direct-chat-dialog .direct-chat-line a { color: var(--chat-ink); font-weight: 700; }
#dialog.direct-chat-dialog .direct-chat-request { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
#dialog.direct-chat-dialog .direct-chat-request .button { min-height: 42px; border-radius: 999px; }
#dialog.direct-chat-dialog .direct-chat-request .button.green { background: var(--chat-clay); border-color: var(--chat-clay); color: var(--chat-clay-ink); }
#dialog.direct-chat-dialog .direct-chat-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 4px 10px; margin: 0; }
#dialog.direct-chat-dialog .direct-chat-compose textarea#direct-text {
  display: block; width: 100%; min-height: 46px; max-height: 160px; margin: 0; padding: 11px 16px; resize: none; box-sizing: border-box;
  border: 1px solid var(--chat-line); border-radius: 23px; background: var(--chat-paper); color: var(--chat-ink); font: inherit; font-size: 16px; line-height: 1.4;
}
#dialog.direct-chat-dialog .direct-chat-compose textarea#direct-text:focus { border-color: var(--chat-clay); background: var(--chat-card); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-clay) 22%, transparent); }
#dialog.direct-chat-dialog .direct-chat-send {
  display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%;
  background: var(--chat-clay); color: var(--chat-clay-ink); cursor: pointer; transition: transform .12s, filter .12s;
}
#dialog.direct-chat-dialog .direct-chat-send:hover:not(:disabled) { filter: brightness(.92); }
#dialog.direct-chat-dialog .direct-chat-send:active:not(:disabled) { transform: scale(.94); }
#dialog.direct-chat-dialog .direct-chat-send:disabled { opacity: .55; cursor: default; }
#dialog.direct-chat-dialog .direct-chat-hint { grid-column: 1 / -1; margin: 0 6px; color: var(--chat-muted); font-size: 11.5px; }
#dialog.direct-chat-dialog .direct-chat-feedback { grid-column: 1 / -1; margin: 0 6px; color: var(--chat-clay); font-size: 12.5px; }
#dialog.direct-chat-dialog .direct-chat-feedback:empty { display: none; }
#dialog.direct-chat-dialog #direct-session-guard { margin: 16px; }
/* Mobile : plein écran, la saisie suit le clavier. */
@media (max-width: 820px), (max-width: 1000px) and (max-height: 560px) {
  #dialog.direct-chat-dialog {
    position: fixed; inset: var(--dialog-viewport-top, 0px) 0 auto; margin: 0; width: 100%; max-width: 100%;
    height: var(--dialog-viewport-height, 100dvh); max-height: var(--dialog-viewport-height, 100dvh); border: 0; border-radius: 0;
  }
  #dialog.direct-chat-dialog .direct-chat-head { padding: calc(8px + env(safe-area-inset-top)) 8px 8px; gap: 6px; }
  #dialog.direct-chat-dialog .direct-chat-bubble { max-width: 84%; }
  #dialog.direct-chat-dialog .direct-chat-hint { display: none; }
  #dialog.direct-chat-dialog .direct-chat-foot { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { #dialog.direct-chat-dialog .direct-chat-send { transition: none; } }
