/* Assistant — 26/09/2026 ergonomics pass.
   The conversation takes the whole height: one centred column, the thread
   filling the screen, the input anchored at the bottom; an empty conversation
   puts the input in the centre, under the choice of mode. The former header
   band (title, subtitle, both modes, the explanation, « Mode fixé ») becomes
   a thin bar: the conversation's title and, once it has started, its mode as
   a tag (the fixed mode is the tag's tooltip). Application tokens only. */

/* The page title stays for assistive technology; the bar replaces the band. */
.forge-shell #chat-view .chat-page-header {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.forge-shell #chat-view .chat-panel-header,
.forge-shell #chat-view[data-grounding-mode="general"] .chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 20px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
/* Before the start screen takes it, the mode choice never shows in the bar. */
.forge-shell #chat-view .chat-panel-header > .chat-grounding-control { display: none; }
.forge-shell #chat-view .chat-bar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.forge-shell #chat-view .chat-bar-title h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--tx);
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.forge-shell #chat-view .chat-bar-title .chat-grounding-badge { flex: 0 0 auto; min-height: 24px; padding: 3px 9px; cursor: default; }
/* The tag appears once the conversation has started. */
.forge-shell #chat-view:not(:has(#answer-card[data-has-answer="true"])) #chat-grounding-badge { display: none; }

/* One centred column. */
.forge-shell #chat-view .conversation-messages { width: min(100%, 800px); }
.forge-shell #chat-view .composer-shell,
.forge-shell #chat-view .composer-hint,
.forge-shell #chat-view .chat-ai-disclaimer { width: min(100%, 800px); }
.forge-shell #chat-view .answer-card { padding: 28px clamp(16px, 4vw, 48px); }
.forge-shell #chat-view .chat-composer { padding: 10px clamp(16px, 4vw, 48px) 12px; }

/* An empty conversation: the start screen and the input in the centre. */
.forge-shell #chat-view:not(:has(#answer-card[data-has-answer="true"])) .answer-card {
  flex: 0 0 auto;
  margin-top: auto;
  overflow: visible;
  padding-bottom: 14px;
}
.forge-shell #chat-view:not(:has(#answer-card[data-has-answer="true"])) .chat-composer { margin-bottom: auto; }
.forge-shell #chat-view .chat-empty-state-card { width: min(100%, 800px); text-align: center; justify-items: center; }
.forge-shell #chat-view .chat-empty-state-card h3 { font-family: var(--serif); font-size: 24px; font-weight: 560; }
.forge-shell #chat-view .chat-start-modes { display: grid; justify-items: center; gap: 8px; margin-top: 10px; }
.forge-shell #chat-view .chat-start-modes:empty { display: none; }
.forge-shell #chat-view .chat-start-modes .chat-grounding-control {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: auto;
  margin: 0;
}
/* Recette 27/09/2026: the choice of source is two cards, each with its image,
   its name, what the AI does and an example — for someone who discovers the
   tool. The selected card is marked by its border, its tint and a filled
   radio, never by colour alone. */
/* .empty-state-card caps itself at 560 px and centres its children (flex):
   the start screen takes its 800 px, the cards the full row. */
.forge-shell #chat-view .chat-empty-state-card { max-width: none; }
.forge-shell #chat-view .chat-empty-state-card .chat-start-modes { align-self: stretch; justify-self: stretch; justify-items: center; }
.forge-shell #chat-view .chat-start-modes .chat-grounding-control { width: min(100%, 720px); }
.forge-shell #chat-view .chat-start-modes .chat-grounding-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.forge-shell #chat-view .chat-start-modes .chat-grounding-option,
.forge-shell #chat-view .chat-start-modes .chat-grounding-option.is-active {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 0;
  padding: 16px 44px 16px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  color: var(--tx);
  font-size: 13px;
  text-align: left;
  box-shadow: var(--sh);
}
.forge-shell #chat-view .chat-start-modes .chat-grounding-option:hover:not(:disabled) {
  border-color: var(--accent-line);
  background: var(--card);
}
.forge-shell #chat-view .chat-start-modes .chat-grounding-option-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--paper);
  color: var(--tx-2);
}
.forge-shell #chat-view .chat-start-modes .chat-grounding-option-copy { display: grid; gap: 4px; min-width: 0; }
.forge-shell #chat-view .chat-start-modes .chat-grounding-option-title { font-size: 15px; font-weight: 700; }
.forge-shell #chat-view .chat-start-modes .chat-grounding-option-example { color: var(--tx-2); font-size: 12.5px; font-weight: 500; line-height: 1.45; }
.forge-shell #chat-view .chat-start-modes .chat-grounding-option-check {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--tx-3);
  border-radius: 50%;
  background: var(--card);
}
.forge-shell #chat-view .chat-start-modes .chat-grounding-option.is-active .chat-grounding-option-check {
  border-color: currentColor;
  box-shadow: inset 0 0 0 4px var(--card);
  background: currentColor;
}
.forge-shell #chat-view .chat-start-modes .chat-grounding-option[data-grounding-mode="documents"].is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--card));
  color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.forge-shell #chat-view .chat-start-modes .chat-grounding-option[data-grounding-mode="general"].is-active {
  border-color: var(--mode-general);
  background: color-mix(in srgb, var(--mode-general-soft) 80%, var(--card));
  color: var(--mode-general);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mode-general) 14%, transparent);
}
.forge-shell #chat-view .chat-start-modes .chat-grounding-option.is-active .chat-grounding-option-icon { background: currentColor; }
.forge-shell #chat-view .chat-start-modes .chat-grounding-option.is-active .chat-grounding-option-icon svg { color: #fff; }
.forge-shell #chat-view .chat-start-modes .chat-grounding-option.is-active .chat-grounding-option-title,
.forge-shell #chat-view .chat-start-modes .chat-grounding-option.is-active .chat-grounding-option-example { color: var(--tx); }
.forge-shell #chat-view .chat-start-modes .chat-grounding-option:disabled:not(.is-active) { opacity: .55; }
/* The glyph and the one-line help of the old switch: the cards say it. */
.forge-shell #chat-view .chat-start-modes #chat-grounding-description:not(.is-note) { display: none; }
.forge-shell #chat-view .chat-start-modes .chat-grounding-context { display: grid; justify-items: center; gap: 4px; text-align: center; }
.forge-shell #chat-view .chat-start-modes #chat-grounding-description { margin: 0; color: var(--tx-2); font-size: 13px; }
.forge-shell #chat-view .chat-empty-state-card .quick-prompts-compact { margin-top: 14px; }

@media (max-width: 760px) {
  .forge-shell #chat-view .chat-panel-header { flex-wrap: wrap; padding: 8px 14px; }
  .forge-shell #chat-view .chat-bar-title { flex: 1 1 100%; flex-wrap: wrap; row-gap: 4px; }
  .forge-shell #chat-view .chat-bar-title h2 { flex: 1 1 100%; }
  .forge-shell #chat-view .chat-empty-state-card h3 { font-size: 20px; }
  .forge-shell #chat-view .chat-start-modes .chat-grounding-switch { grid-template-columns: 1fr; }
}

/* The footer under the input, grouped (26/09/2026): the keyboard hint once,
   then the chosen format on the same centred line; the AI notice under it. */
.forge-shell #chat-view .composer-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 2px 8px;
  margin-top: 6px;
  text-align: center;
}
.forge-shell #chat-view .composer-hint > * { margin: 0; }
.forge-shell #chat-view .composer-hint > :empty { display: none; }
.forge-shell #chat-view .composer-hint > :not(:first-child)::before {
  content: "·";
  margin-right: 8px;
  color: var(--tx-4);
}
.forge-shell #chat-view .chat-ai-disclaimer { margin-top: 2px; text-align: center; }
.forge-shell #chat-view .composer-hint > .chat-shape-summary { flex: 0 1 auto; }

/* 26/09/2026: no template of the organisation — the panel says why, and
   where one is created. */
.forge-shell #chat-view .chat-template-org-empty { display: grid; justify-items: start; gap: 8px; }
.forge-shell #chat-view .chat-template-org-empty-text { margin: 0; color: var(--tx-2); font-size: 12.5px; line-height: 1.5; }

/* 27/09/2026 (decision A): the Assistant orients — a discreet card under the
   latest answer, one button, never a switch. */
.forge-shell #chat-view .chat-orientation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 4px 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
}
.forge-shell #chat-view .chat-orientation-copy { display: grid; gap: 2px; min-width: 0; flex: 1 1 320px; }
.forge-shell #chat-view .chat-orientation-copy p { margin: 0; }
.forge-shell #chat-view .chat-orientation-title { color: var(--accent-soft-ink); font-size: 12.5px; font-weight: 650; }
.forge-shell #chat-view .chat-orientation-text { color: var(--tx-2); font-size: 12.5px; line-height: 1.5; }
.forge-shell #chat-view .chat-orientation-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.forge-shell #chat-view .chat-orientation-dismiss {
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: var(--tx-3);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.forge-shell #chat-view .chat-orientation-dismiss:hover { color: var(--tx); text-decoration: underline; }
.forge-shell #chat-view .chat-orientation-dismiss:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
