/* Accueil — tableau de bord d'après les maquettes D1 « Cockpit » / D5 « Bienvenue » (2026-10-13) :
   fond bleu nuit #0A0C10 avec halos bleus, cadres en verre (flou + liseré clair), bleu #3a5f84 pour les
   boutons principaux, #7d9dbd pour les accents. Police : celle de l'app (Segoe UI Variable). */
#page-home.page.active { display: block; }
body.on-home #taskbar { display: none; }

.hm {
  --hm-bg: #0a0c10;
  --hm-text: #f1f4f8;
  --hm-soft: #b8c2d0;
  --hm-muted: #95a0b0;
  --hm-ink: #7d9dbd;
  --hm-blue: #3a5f84;
  --hm-blue-hi: #45709b;
  --hm-glow: 31, 111, 194;
  --hm-line: rgba(255, 255, 255, 0.08);
  --hm-line-2: rgba(255, 255, 255, 0.14);
  --hm-panel: rgba(255, 255, 255, 0.045);
  --hm-card: rgba(255, 255, 255, 0.04);
  --hm-card-hi: rgba(255, 255, 255, 0.07);
  --hm-teal: var(--hm-ink);
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 60% 55% at 30% 6%, rgba(var(--hm-glow), 0.126), transparent 70%),
    radial-gradient(circle at 92% 92%, rgba(var(--hm-glow), 0.084), transparent 42%),
    var(--hm-bg);
  color: var(--hm-text);
  font-family: var(--dv-font);
  font-weight: 400;
  scroll-behavior: smooth;
}
.hm::-webkit-scrollbar { width: 10px; }
.hm::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 5px; border: 3px solid transparent; background-clip: padding-box; }
.hm button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- Verre ---------- */
.hm-glass {
  background: var(--hm-panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ---------- Barre du haut ---------- */
.hm-nav {
  position: sticky;
  top: 16px;
  z-index: 20;
  margin: 16px 16px 0;
  min-height: 58px;
  padding: 8px 12px 8px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 22px;
  background: rgba(14, 17, 23, 0.6);
  transition: background 0.25s, box-shadow 0.25s;
}
.hm.scrolled .hm-nav { background: rgba(12, 15, 20, 0.86); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 16px 44px rgba(0, 0, 0, 0.6); }
.hm-logo { display: flex; align-items: center; gap: 9px; font-weight: 700 !important; font-size: 17px; letter-spacing: -0.01em; }
.hm-logo img { width: 22px; height: 22px; object-fit: contain; }
.hm-links { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.hm-links > button:not(.dv-acc-btn) {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--hm-soft);
  transition: color 0.2s, background 0.2s;
}
.hm-links > button:not(.dv-acc-btn):hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.hm-links > button.on { color: #fff; font-weight: 700; }
/* compteur de crédits et compte, dans la barre (ajoutés par abonnement.js et compte.js) */
.hm-links .dv-credits { height: 34px; margin-left: 8px; padding: 0 12px 0 9px; border-radius: 17px; border-color: rgba(111, 157, 203, 0.245); background: rgba(var(--hm-glow), 0.105); font-size: 14px; }
.hm-links .dv-credits:hover { background: rgba(var(--hm-glow), 0.182); }
.hm-links .dv-acc-btn { height: 40px; }
.hm-links .dv-acc-btn.on { width: 40px; height: 40px; background: var(--hm-blue); border-color: rgba(255, 255, 255, 0.25); }
/* bouton du thème clair / sombre (point 114) : lune en thème sombre, soleil en thème clair */
.hm-theme { flex: none; width: 36px; height: 36px; margin-left: 6px; display: grid; place-items: center; border-radius: 18px; border: 1px solid var(--hm-line-2); color: var(--hm-soft); transition: color 0.2s, background 0.2s; }
.hm-theme:hover { color: var(--hm-text); background: var(--hm-panel); }
.hm-theme svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hm-theme .hm-theme-sun { display: none; }
html[data-theme="clair"] .hm-theme .hm-theme-sun { display: inline; }
html[data-theme="clair"] .hm-theme .hm-theme-moon { display: none; }
/* Langue de l'interface (point 112) : liste à côté du thème */
.hm-lang { flex: none; height: 36px; margin-left: 6px; padding: 0 8px; border-radius: 18px; border: 1px solid var(--hm-line-2); background: transparent; color: var(--hm-soft); font: inherit; font-size: 13px; cursor: pointer; }
.hm-lang:hover { color: var(--hm-text); background: var(--hm-panel); }
.hm-lang option { color: #111; background: #fff; }
.hm-status { margin-left: 14px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--hm-muted); white-space: nowrap; }
.hm-status.live { color: #8fd3a8; }
.hm-status.error { color: #ff9f8f; }
.hm-status[hidden] { display: none !important; }

/* ---------- Tableau de bord : colonne principale + colonne de droite ---------- */
.hm-cockpit {
  width: calc(100% - 32px);
  max-width: 1440px;
  margin: 0 auto;
  padding: 36px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 22px;
}
.hm-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 26px; }
.hm-side { flex: 1 1 280px; max-width: 360px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 96px; }

/* Salutation */
.hm-hello { display: flex; flex-direction: column; gap: 6px; }
.hm-hi { font-size: 15px; color: var(--hm-soft); }
.hm-hi span { color: #fff; font-weight: 600; }
.hm-title { font-size: clamp(2rem, 3.4vw, 2.9rem); font-weight: 700; letter-spacing: -0.035em; line-height: 1.06; }
.hm-accent { color: var(--hm-ink); }
.hm-lead { color: var(--hm-muted); font-size: 15px; }
.hm-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--hm-ink); }

/* ---------- Barre IA ---------- */
.hm-ai { position: relative; }
.hm-composer { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: 20px; transition: border-color 0.2s, box-shadow 0.2s; }
.hm-composer:focus-within { border-color: rgba(111, 157, 203, 0.385); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 4px rgba(var(--hm-glow), 0.098), 0 12px 40px rgba(0, 0, 0, 0.5); }
.hm-composer-row { display: flex; align-items: center; gap: 8px; padding-left: 10px; }
.hm-composer-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--hm-ink); stroke-width: 1.6; stroke-linejoin: round; }
.hm-composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  max-height: 180px;
  padding: 13px 6px;
  resize: none;
  background: none;
  border: 0;
  outline: none;
  color: var(--hm-text);
  font: 500 16px var(--dv-font-text);
  line-height: 1.4;
}
.hm-composer textarea::placeholder { color: var(--hm-muted); }
.hm-tools-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--hm-line); }
.hm-grow { flex-grow: 1; }
.hm-attach {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid var(--hm-line-2) !important;
  background: rgba(255, 255, 255, 0.04) !important;
  color: #e6ebf2 !important;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s, border-color 0.2s, background 0.2s, opacity 0.2s;
}
.hm-attach:hover:not(:disabled) { color: #fff !important; border-color: rgba(255, 255, 255, 0.28) !important; background: rgba(255, 255, 255, 0.08) !important; }
.hm-attach:disabled { opacity: 0.45; cursor: default; }
.hm-attach svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hm-send {
  flex: none;
  min-height: 46px;
  min-width: 130px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  background: var(--hm-blue) !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 16px rgba(var(--hm-glow), 0.14);
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
}
.hm-send:hover:not(:disabled) { background: var(--hm-blue-hi) !important; }
.hm-send:active:not(:disabled) { transform: scale(0.98); }
.hm-send:disabled { opacity: 0.45; cursor: default; }
.hm-send .ico-stop, .hm-send.stop .ico-send { display: none; }
.hm-send.stop .ico-stop { display: inline; }
.hm-send.stop { background: #2a2f38 !important; color: #fff !important; }
/* pastilles de coût (« −100 ») dans l'accueil */
.hm .dv-cost { padding: 1px 7px; border-radius: 9px; background: rgba(var(--hm-glow), 0.14); border: 1px solid rgba(111, 157, 203, 0.245); font-size: 11px; font-weight: 700; color: #d5e3f1; }
/* suggestions */
.hm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hm-chip {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 17px;
  border: 1px solid var(--hm-line-2) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  font-size: 13.5px;
  color: #e6ebf2 !important;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.hm-chip:hover { color: #fff !important; border-color: rgba(111, 157, 203, 0.35) !important; background: rgba(var(--hm-glow), 0.098) !important; }
.hm-meta { display: block; margin: 10px 4px 0; font-size: 12.5px; color: var(--hm-muted); }
.hm-meta.warn { color: #f0c27a; }
/* vignettes des références */
.hm-composer .gen-refs { display: none; flex-wrap: wrap; gap: 8px; padding: 4px 10px 0; }
.hm-composer .gen-refs.has-refs { display: flex; }
.gen-ref { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid var(--hm-line-2); background: #111; }
.gen-ref img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.gen-ref-remove { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 10px; background: rgba(0, 0, 0, 0.7) !important; color: #fff !important; font-size: 13px; line-height: 1; opacity: 0; transition: opacity 0.2s; }
.gen-ref:hover .gen-ref-remove { opacity: 1; }
/* glisser-déposer */
.gen-drop {
  position: absolute;
  inset: -10px;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  border: 1.5px dashed rgba(111, 157, 203, 0.49);
  background: rgba(10, 14, 22, 0.88);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  pointer-events: none;
}
.hm-ai.dragging .gen-drop { display: flex; }

/* ---------- Conversation ---------- */
.hm-conv { display: none; margin-top: 18px; border-radius: 20px; overflow: hidden; }
.hm-ai.has-thread .hm-conv { display: block; animation: hm-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes hm-in { from { opacity: 0; transform: translateY(10px); } }
.hm-conv-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--hm-line); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--hm-ink); }
.hm-conv-head .gen-actions { display: flex; gap: 8px; letter-spacing: 0; text-transform: none; }
.hm-mini { height: 32px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--hm-line-2) !important; background: rgba(255, 255, 255, 0.04) !important; font-size: 12.5px; font-weight: 600; color: #e6ebf2 !important; }
.hm-mini:hover:not(:disabled) { color: #fff !important; border-color: rgba(255, 255, 255, 0.3) !important; }
.hm-mini:disabled { opacity: 0.4; cursor: default; }
.gen-scroll { max-height: min(62vh, 720px); overflow-y: auto; padding: 22px clamp(16px, 3vw, 40px) 28px; }
.gen-scroll::-webkit-scrollbar { width: 8px; }
.gen-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
.gen-thread { display: flex; flex-direction: column; gap: 22px; }
.gen-msg { display: flex; gap: 12px; }
.gen-msg.user { flex-direction: column; align-items: flex-end; }
.gen-msg.ai { align-items: flex-start; }
.gen-bubble { max-width: min(860px, 88%); font-size: 15px; line-height: 1.55; color: var(--hm-text); white-space: pre-wrap; }
.gen-msg.user .gen-bubble { padding: 12px 16px; border-radius: 16px 16px 4px 16px; background: rgba(var(--hm-glow), 0.112); border: 1px solid rgba(111, 157, 203, 0.21); }
.gen-msg.ai .gen-bubble { padding: 4px 0; white-space: normal; }
.gen-msg.error .gen-bubble { color: #ff9f8f; }
.gen-avatar { width: 30px; height: 30px; flex: none; background: url("../images/logo-barre.png") center / 74% no-repeat; } /* (logo Devclo seul, sur fond transparent) */
/* Pendant que l'IA travaille : logo Devclo animé (images/logo-anime.gif) à la place du logo fixe */
.gen-msg.waiting .gen-avatar { width: 40px; height: 40px; margin: -5px; border-radius: 0; background: url("../images/logo-anime.gif") center / contain no-repeat; box-shadow: none; } /* (le GIF seul, entier, sans carré bleu) */
.gen-msg-refs, .gen-result-images { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.gen-result-images { justify-content: flex-start; margin-top: 12px; }
.gen-msg-refs img { width: 88px; height: 88px; object-fit: cover; border-radius: 12px; border: 1px solid var(--hm-line-2); cursor: zoom-in; }
.gen-result-images img { max-width: 320px; max-height: 320px; border-radius: 14px; border: 1px solid var(--hm-line-2); cursor: zoom-in; }
.gen-rich { white-space: normal; }
.gen-h { margin: 14px 0 6px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.gen-rich > .gen-h:first-child { margin-top: 0; }
.gen-p { margin: 2px 0; color: #d9dee6; }
.gen-li { position: relative; margin: 3px 0; padding-left: 16px; color: #d9dee6; }
.gen-li::before { content: ""; position: absolute; left: 3px; top: 0.7em; width: 5px; height: 5px; border-radius: 50%; background: var(--hm-ink); }
.gen-sp { height: 8px; }
.gen-rich strong { color: #fff; font-weight: 600; }
.gen-sketch { margin-top: 14px; padding: 14px; border-radius: 16px; background: #f4f2ee; max-width: 560px; }
.gen-sketch img { display: block; width: 100%; cursor: zoom-in; }
.gen-sketch.pending { background: var(--hm-card-hi); color: var(--hm-soft); }
.gen-typing { display: inline-flex; gap: 4px; vertical-align: middle; }
.gen-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--hm-soft); animation: hm-dot 1.2s infinite ease-in-out; }
.gen-typing i:nth-child(2) { animation-delay: 0.15s; }
.gen-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes hm-dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.gen-typing-label { margin-left: 10px; font-size: 13px; color: var(--hm-soft); }
.gen-lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.88); cursor: zoom-out; }
.gen-lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 12px; background: #f4f2ee; }

/* ---------- Blocs : points de départ, projets à reprendre ---------- */
.hm-block { display: flex; flex-direction: column; gap: 12px; }
.hm-block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hm-h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.hm-link { font-size: 14px; color: var(--hm-ink) !important; }
.hm-link:hover { color: #fff !important; text-decoration: underline; text-underline-offset: 3px; }

/* Points de départ (cartes de la maquette « Bienvenue ») */
.hm-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.hm-tile { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 236px; padding: 20px; border-radius: 22px; overflow: hidden; transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1); }
.hm-tile:hover { transform: translateY(-2px); border-color: rgba(111, 157, 203, 0.315); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 12px 40px rgba(var(--hm-glow), 0.126); }
.hm-badge { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: rgba(var(--hm-glow), 0.126); border: 1px solid rgba(111, 157, 203, 0.245); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.hm-badge svg { width: 22px; height: 22px; fill: none; stroke: #d5e3f1; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hm-tile h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.hm-tile p { font-size: 14px; line-height: 1.5; color: var(--hm-muted); }
.hm-tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--hm-soft); }
.hm-tags > span:not(.dv-cost) { padding: 3px 9px; border-radius: 10px; border: 1px solid var(--hm-line-2); }
.hm-tags > .dv-cost { margin: 0; padding: 3px 9px; border-radius: 10px; font-size: 12px; }
.hm-tags > .dv-cost::after { content: "\00a0 crédits"; font-weight: 600; }
.hm-go-link { margin-top: auto; display: flex !important; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid transparent !important; font-weight: 700; color: var(--hm-ink) !important; text-align: left; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.hm-go-link:hover { color: #fff !important; background: rgba(var(--hm-glow), 0.126) !important; border-color: rgba(111, 157, 203, 0.245) !important; }
.hm-arrow { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s; }
.hm-go-link:hover .hm-arrow { transform: translateX(3px); }
.hm-split { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.hm-split .hm-go-link { margin-top: 0; }

/* Projets à reprendre (cartes de la maquette « Cockpit » : aperçu, nom, étape, avancement) */
.hm-recent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.hm-proj { position: relative; display: flex !important; flex-direction: column; padding: 0; border-radius: 18px; overflow: hidden; text-align: left; transition: border-color 0.25s, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s; }
.hm-proj:hover { transform: translateY(-2px); border-color: rgba(111, 157, 203, 0.315); }
.hm-proj-prev {
  position: relative;
  display: block;
  height: 170px;
  background: radial-gradient(circle at 50% 50%, rgba(var(--hm-glow), 0.154), transparent 70%);
  border-bottom: 1px solid var(--hm-line);
}
.hm-proj-prev svg { position: absolute; inset: 18px; width: calc(100% - 36px); height: calc(100% - 36px); overflow: visible; }
.hm-proj-info { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.hm-proj-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hm-proj-top b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 700; }
.hm-stage { flex: none; padding: 3px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; border: 1px solid rgba(255, 255, 255, 0.18); color: var(--hm-soft); }
.hm-steps3 { display: flex; gap: 4px; }
.hm-steps3 i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.hm-steps3 i.on { background: var(--hm-blue); }
.hm-proj-info small { font-size: 12.5px; color: var(--hm-muted); }

/* ---------- Colonne de droite ---------- */
.hm-card-side { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 20px; }
.hm-cred-big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.hm-cred-big b { font-size: 36px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hm-cred-big span, .hm-small { font-size: 13.5px; color: var(--hm-muted); }
.hm-gauge { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.hm-gauge i { display: block; width: 0; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--hm-blue), #628fbc); transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.hm-ghost { min-height: 44px; margin-top: 4px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.16) !important; background: rgba(255, 255, 255, 0.06) !important; font-weight: 600; color: var(--hm-text) !important; transition: background 0.2s, border-color 0.2s; }
.hm-ghost:hover { background: rgba(var(--hm-glow), 0.14) !important; border-color: rgba(111, 157, 203, 0.315) !important; }
.hm-costs { list-style: none; display: flex; flex-direction: column; }
.hm-costs li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--hm-line); font-size: 13.5px; color: var(--hm-soft); }
.hm-costs li:last-child { border-bottom: 0; padding-bottom: 0; }
.hm-costs .dv-cost { margin: 0; }
.hm-free { font-size: 12px; font-weight: 600; color: #8fd3a8; }

/* ---------- Lueur qui suit la souris ---------- */
.hm-glow::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(260px 220px at var(--mx, 50%) var(--my, 30%), rgba(var(--hm-glow), 0.112), transparent 70%);
  transition: opacity 0.35s;
}
.hm-glow:hover::before { opacity: 1; }
.hm-glow > * { position: relative; }

.hm-end { height: 60px; }

/* ---------- Apparition ---------- */
.hm-reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.hm-reveal.in { opacity: 1; transform: none; }
.hm-main > .hm-reveal:nth-child(2) { transition-delay: 0.06s; }
.hm-main > .hm-reveal:nth-child(3) { transition-delay: 0.12s; }
.hm-main > .hm-reveal:nth-child(4) { transition-delay: 0.18s; }
.hm-side.hm-reveal { transition-delay: 0.1s; }
@media (prefers-reduced-motion: reduce) {
  .hm-reveal { opacity: 1; transform: none; transition: none; }
  .hm-tile, .hm-proj, .hm-gauge i { transition: none; }
}

/* ---------- Fenêtre étroite ---------- */
@media (max-width: 1100px) {
  .hm-side { position: static; max-width: none; flex-direction: row; flex-wrap: wrap; }
  .hm-side > * { flex: 1 1 260px; }
}
@media (max-width: 900px) {
  .hm-tiles, .hm-recent-grid { grid-template-columns: 1fr; }
  .hm-attach span:not(.dv-cost) { display: none; }
  .hm-links > button:not(.dv-acc-btn):nth-child(n + 4) { display: none; }
}

/* ---------- Plus d'air, toute la largeur, crédits collés à droite (2026-10-13) ---------- */
.hm-cockpit { max-width: none; padding-top: 56px; gap: 40px; }
.hm-main { flex: 1 1 560px; gap: 64px; }
.hm-main > .hm-ai { margin-top: -28px; } /* la barre IA reste près de la salutation */
.hm-block { gap: 18px; }
.hm-tiles, .hm-recent-grid { gap: 20px; }
.hm-side { flex: 0 0 340px; max-width: 340px; margin-left: auto; gap: 20px; }
.hm-end { height: 96px; }
/* la conversation s'affiche sur la page IA, pas à l'accueil */
#page-home .hm-conv { display: none !important; }
@media (max-width: 1100px) {
  .hm-side { flex: 1 1 100%; max-width: none; margin-left: 0; }
}

/* ---------- Page IA (maquette D3 « Galerie ») : onglets, galerie, conversation, barre IA en bas ---------- */
#page-ia.page.active { display: block; }
.hm-iapage {
  padding-bottom: 150px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(var(--hm-glow), 0.14), transparent 60%),
    radial-gradient(ellipse 50% 40% at 20% 0%, rgba(var(--hm-glow), 0.07), transparent 70%),
    var(--hm-bg);
}
.hm-iapage .hm-links > button.on { cursor: default; }
.ia-head { margin: 0 16px; padding: 44px 0 26px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.ia-head .hm-title { font-size: clamp(2rem, 3.6vw, 2.9rem); }

/* conversation : au-dessus de la galerie */
.ia-slot { margin: 0 16px; }
#page-ia .hm-ai { position: static; }
#page-ia .hm-conv { margin: 0 0 28px; }
#page-ia .gen-scroll { max-height: min(56vh, 640px); }


/* barre IA en bas de la page : une ligne (description, Images, Dossier, Patronner, Générer) */
#page-ia .hm-composer {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 15;
  width: min(980px, calc(100% - 32px));
  transform: translateX(-50%);
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-radius: 30px;
  background: rgba(20, 26, 36, 0.72);
  border-color: rgba(111, 157, 203, 0.168);
}
#page-ia .hm-composer-row, #page-ia .hm-tools-row { display: contents; }
#page-ia .hm-composer .gen-refs { flex: 1 1 100%; order: -1; padding: 4px 0 2px; }
#page-ia .hm-composer-ico { order: 0; }
#page-ia .hm-composer textarea { order: 1; flex: 1 1 240px; min-height: 44px; padding: 11px 4px; font-size: 15px; }
#page-ia #gen-attach { order: 2; }
#page-ia #gen-folder-btn { order: 3; }
#page-ia #gen-pattern { order: 4; }
#page-ia .hm-send { order: 5; min-height: 44px; border-radius: 22px; }
#page-ia .hm-attach { border-radius: 12px; }
#page-ia .hm-grow, #page-ia .hm-chips { display: none; } /* (les suggestions sont dans l'onglet Inspirations) */
#page-ia .hm-meta { position: fixed; left: 50%; bottom: 6px; z-index: 15; transform: translateX(-50%); margin: 0; font-size: 11.5px; white-space: nowrap; }
#page-ia .gen-drop { position: fixed; inset: 90px 16px 16px; z-index: 40; }
#page-ia .hm-composer.ia-pulse { animation: ia-pulse 0.7s ease-out; }
@keyframes ia-pulse { 0% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 0 rgba(111, 157, 203, 0.385); } 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 14px rgba(111, 157, 203, 0); } }
#page-ia .hm-composer textarea { scrollbar-width: none; }
#page-ia .hm-composer textarea::-webkit-scrollbar { display: none; }
#page-ia .hm-composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Titres centrés (accueil, page IA) ; page IA : barre en haut au centre, puis « Patronner », puis galerie ---------- */
.hm-hello { align-items: center; text-align: center; }
.hm-meta { text-align: center; }
.hm-iapage { padding-bottom: 80px; }
.ia-head { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 52px 0 28px; }
.ia-head .hm-lead { max-width: 560px; }
.ia-slot { width: min(980px, calc(100% - 32px)); margin: 0 auto; }
#page-ia .hm-composer { position: relative; left: auto; bottom: auto; z-index: auto; width: 100%; transform: none; }
#page-ia .hm-meta { position: static; transform: none; margin: 10px 0 0; white-space: normal; }
#page-ia .hm-conv { margin: 22px 0 0; }


/* Accueil : un peu plus de marge à gauche (le bord droit reste aligné sur la barre du haut) */
.hm-cockpit { width: calc(100% - 2 * var(--dv-edge)); margin: 0 var(--dv-edge); }
/* un peu plus d'espace entre le titre et la barre IA */
.hm-main > .hm-ai { margin-top: -10px; }
.hm-main > .hm-ai { margin-top: 8px; }

/* Lueur bleue au survol divisée par deux (2026-10-13) */
.hm-glow::before { background: radial-gradient(260px 220px at var(--mx, 50%) var(--my, 30%), rgba(var(--hm-glow), 0.056), transparent 70%); }
.hm-tile:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 40px rgba(var(--hm-glow), 0.063); border-color: rgba(111, 157, 203, 0.21); }
.hm-proj:hover { border-color: rgba(111, 157, 203, 0.21); }
.hm-go-link:hover { background: rgba(var(--hm-glow), 0.063) !important; border-color: rgba(111, 157, 203, 0.126) !important; }
.hm-chip:hover { background: rgba(var(--hm-glow), 0.049) !important; border-color: rgba(111, 157, 203, 0.21) !important; }
.hm-ghost:hover { background: rgba(var(--hm-glow), 0.07) !important; border-color: rgba(111, 157, 203, 0.21) !important; }
.hm-composer:focus-within { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 4px rgba(var(--hm-glow), 0.049), 0 12px 40px rgba(0, 0, 0, 0.5); }


/* ---------- Page IA (2026-11-16) : à gauche titre + créations précédentes, à droite la discussion ----------
   Créations : grille 2 × 2 dans un cadre de verre ; au-delà de 4, la molette fait défiler les plus anciennes
   (une ligne à la fois). Discussion : logo en tête, messages, barre IA (trombone, description, Générer) en bas. */
.hm-iapage { display: flex; flex-direction: column; padding-bottom: 0; }
.ia-layout {
  --ia-h: clamp(420px, calc(100vh - 210px), 760px);
  --gal-h: max(260px, calc(var(--ia-h) - clamp(150px, 20vh, 190px)));
  flex: 1;
  /* bords gauche et droit = ceux de la barre du haut ; écart au centre = marge extérieure de la barre.
     Le titre et les créations prennent la largeur du titre, la discussion le reste ; si la fenêtre rétrécit,
     la colonne de gauche cède la place en premier (la discussion garde au moins 420 px). */
  width: calc(100% - 2 * var(--dv-edge));
  margin: 0 var(--dv-edge);
  padding: clamp(28px, 7vh, 72px) 0 40px;
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(min(420px, 100%), 1fr);
  gap: var(--dv-edge);
  align-content: start; /* la ligne garde la hauteur de la discussion (sinon elle remplit la page) */
  align-items: stretch; /* haut et bas des deux blocs alignés : le cadre des créations s'étire jusqu'au bas de la discussion */
}
/* la colonne prend la largeur du titre : le bord droit du titre, du sous-titre et du cadre des créations
   reste aligné quelle que soit la taille de la fenêtre (le cadre ne compte pas dans ce calcul) */
/* Colonne de gauche : son bord gauche est celui de la barre ; sa largeur vient du cadre des créations, qui garde
   la forme rectangulaire 4:3 de la maquette (hauteur = bas de la discussion moins l'en-tête). Le titre et le
   sous-titre sont calés sur le bord droit du cadre ; si la fenêtre rétrécit, c'est cette colonne qui cède
   (la discussion garde au moins 420 px). */
.ia-left { min-width: 0; width: calc(var(--gal-h) * 4 / 3); max-width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr var(--gal-h); }
.ia-head { display: flex; flex-direction: column; align-items: center; width: auto; max-width: none; margin: 0; padding: 0; text-align: center; } /* titre et sous-titre centrés sur le cadre des créations */
.ia-head .hm-title { font-size: min(clamp(2rem, 3.4vw, 2.9rem), calc(var(--gal-h) * 4 / 3 / 11)); white-space: nowrap; } /* même taille que le titre de l'accueil ; réduite seulement s'il ne tient plus dans la largeur du cadre */
.ia-head .hm-lead { max-width: none; margin-top: 4px; text-align: center; color: var(--hm-muted); font-size: 15px; } /* même taille que le sous-titre de l'accueil */
.ia-label { align-self: end; margin: 0 0 10px 2px; font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--hm-muted); }

.ia-gallery {
  --gap: 20px;
  --pad: 10px;
  height: auto;
  min-height: 0;
  container-type: size; /* la hauteur des cases suit celle du cadre (2 lignes visibles) */
  padding: var(--pad);
  border-radius: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scroll-padding: var(--pad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 40px rgba(0, 0, 0, 0.4);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
.ia-gallery::-webkit-scrollbar { width: 6px; }
.ia-gallery::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 3px; }
.ia-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* deux lignes remplissent exactement le cadre */
  grid-auto-rows: calc((100cqh - var(--gap)) / 2);
  gap: var(--gap);
  margin: 0;
}
.ia-tile {
  position: relative;
  display: block;
  min-width: 0;
  padding: 0;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: rgba(255, 255, 255, 0.025) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  scroll-snap-align: start;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.ia-tile.ia-has { cursor: pointer; outline: none; animation: hm-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
.ia-tile.ia-has:hover, .ia-tile.ia-has:focus-visible { transform: translateY(-2px); border-color: rgba(111, 157, 203, 0.3) !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 30px rgba(var(--hm-glow), 0.08); }
.ia-tile img { width: 100%; height: 100%; display: block; object-fit: cover; }
.ia-tile img:not([src]) { visibility: hidden; }
.ia-tile.ia-sketch { background: #f4f2ee !important; }
.ia-tile.ia-sketch img { object-fit: contain; padding: 10px; }
.ia-tile-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 10px; background: linear-gradient(transparent, rgba(6, 8, 12, 0.85)); color: #f1f4f8; font-size: 12.5px; line-height: 1.35; text-align: left; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
.ia-tile.ia-has:hover .ia-tile-cap, .ia-tile.ia-has:focus-visible .ia-tile-cap { opacity: 1; transform: none; }
.ia-slot-empty { border-color: rgba(255, 255, 255, 0.08) !important; }

/* Cadre de discussion */
.ia-panel { height: var(--ia-h); display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 40px rgba(0, 0, 0, 0.4); }
.ia-panel .ia-slot { flex: 1; min-height: 0; width: auto; margin: 0; display: flex; }
#page-ia .hm-ai { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
#page-ia .hm-conv {
  order: 0;
  flex: 1;
  min-height: 0;
  margin: 0;
  display: flex !important;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: none;
}
#page-ia .hm-conv-head { flex: none; min-height: 52px; padding: 10px 14px 10px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.hm-conv-logo { width: 22px; height: 22px; object-fit: contain; display: block; }
#page-ia .hm-ai:not(.has-thread) .gen-actions { visibility: hidden; }
#page-ia .gen-scroll { flex: 1; min-height: 0; max-height: none; padding: 20px clamp(14px, 2.4vw, 28px) 16px; }
#page-ia .hm-composer {
  order: 1;
  flex: none;
  width: auto;
  margin: 0 22px 26px;
  padding: 4px 4px 4px 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
#page-ia .hm-composer:focus-within { border-color: rgba(111, 157, 203, 0.35); box-shadow: 0 0 0 3px rgba(var(--hm-glow), 0.06); }
#page-ia .hm-composer-row, #page-ia .hm-tools-row { display: contents; }
#page-ia .hm-composer .gen-refs { flex: 1 1 100%; order: -1; padding: 8px 10px 4px; }
#page-ia .hm-composer-ico, #page-ia #gen-folder-btn, #page-ia .hm-grow, #page-ia .hm-chips { display: none !important; }
#page-ia #gen-attach {
  order: 0;
  align-self: stretch;
  min-height: 0;
  padding: 0 12px;
  border: 0 !important;
  border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 0;
  background: none !important;
  color: var(--hm-muted) !important;
}
#page-ia #gen-attach:hover { color: #fff !important; }
#page-ia #gen-attach > svg:not(.hm-clip), #page-ia #gen-attach > span { display: none; }
#page-ia #gen-attach .hm-clip { width: 17px; height: 17px; }
.hm-clip { display: none; }
#page-ia .hm-clip { display: block; }
#page-ia .hm-composer textarea { order: 1; flex: 1 1 160px; min-height: 34px; max-height: 140px; padding: 8px 10px; font-size: 13px; font-weight: 400; }
#page-ia #gen-pattern { order: 2; min-height: 30px; margin-right: 6px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
#page-ia #gen-pattern:disabled { display: none !important; }
#page-ia .hm-send {
  order: 3;
  min-height: 30px;
  min-width: 98px;
  padding: 0 14px;
  border-radius: 9px;
  background: linear-gradient(90deg, #3a5f84, #6f93b8) !important;
  font-size: 12.5px;
  font-weight: 600;
}
#page-ia .hm-send:hover:not(:disabled) { background: linear-gradient(90deg, #45709b, #7ea2c6) !important; }
#page-ia .hm-send .dv-cost { margin-left: 6px; }
#page-ia .hm-meta { order: 2; flex: none; margin: -18px 22px 8px; font-size: 11.5px; text-align: left; }
#page-ia .hm-meta:not(.warn) { display: none; }
#page-ia .gen-drop { position: fixed; inset: 90px 16px 16px; z-index: 40; }

/* Barre du haut : page active en gras soulignée, logo seul un peu plus grand */
.hm-logo img { width: 26px; height: 26px; }
.hm-links > button.on:not(.dv-acc-btn) { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }

@media (max-width: 1000px) {
  .ia-layout { grid-template-columns: 1fr; --ia-h: clamp(440px, 70vh, 640px); }
  .ia-left { width: 100%; }
  .ia-label { margin-top: 28px; }
  .hm-iapage { padding-bottom: 40px; }
}

/* Barre du haut resserrée (2026-11-16) : mêmes marges que la barre des autres pages */
.hm-nav { margin-left: var(--dv-edge); margin-right: var(--dv-edge); }

/* Poubelle des créations : en bas à droite, dans le bandeau grisé qui apparaît au survol (avec la description) */
.ia-tile.dv-trash-host > .dv-trash { top: auto; bottom: 8px; right: 8px; transform: translateY(3px); }
.ia-tile.dv-trash-host:hover > .dv-trash, .ia-tile.dv-trash-host:focus-within > .dv-trash, .ia-tile > .dv-trash.armed { transform: none; }
.ia-tile.dv-trash-host .ia-tile-cap { min-height: 48px; padding-right: 50px; }

/* Haut du titre (accent du « é », jambages de « d ») aligné sur le haut du cadre de discussion : la boîte de ligne
   laisse ~0,17 em de vide au-dessus des lettres, on la remonte d'autant (proportionnel à la taille du titre) */
.ia-head .hm-title { margin-top: -0.174em; }

/* Barre du haut : un peu plus d'espace entre les pages */
.hm-links { gap: 10px; }

/* Créations : la pièce entière dans la case, jamais rognée (contain), sur un fond gris clair. Le fond blanc des
   photos générées se fond dans ce gris (mode « plus sombre » : ce qui est plus clair que le fond prend sa couleur, le gris des nouvelles photos lui est identique). */
.ia-tile.ia-has { background: #e9ebee !important; }
.ia-tile.ia-has img { object-fit: contain; padding: 8px; mix-blend-mode: darken; }
.ia-tile.ia-has.ia-sketch { background: #e9ebee !important; }

/* Renommer : le champ prend la place de la description dans le bandeau, qui reste affiché */
.ia-tile.renaming .ia-tile-cap { opacity: 1; transform: none; display: flex; align-items: center; -webkit-line-clamp: unset; }
.ia-rename { width: 100%; height: 28px; padding: 0 8px; border-radius: 7px; border: 1px solid rgba(125, 157, 189, 0.6); background: rgba(0, 0, 0, 0.45); color: #fff; font: 500 12.5px var(--dv-font-text); outline: none; box-shadow: 0 0 0 3px rgba(31, 111, 194, 0.18); }
.ia-tile-cap[hidden] { display: none !important; }
