/* Lot T (02/10/2026, decisions of Jean-Charles of 01/10): the Assistant page.
   One task selector; conversations grouped by date with their details on
   hover; the sources by title in a grid aligned on the text column; the
   answer's actions on one line, discreet until hovered; the abstention, the
   missing questions and the full conversation as cards; the T avatar; the
   page title « Assistant » in Jost (the large titles keep the serif).
   Application tokens only. */

/* The formats, the « Gabarit » panel and the format line give way. */
.forge-shell .chat-view #chat-mode-group,
.forge-shell .chat-view #chat-shape-anchor,
.forge-shell .chat-view #chat-shape-summary { display: none !important; }

.forge-shell .chat-view .chat-page-title { font-family: 'Jost', var(--sans); font-weight: 500; letter-spacing: -0.01em; }
.forge-shell .chat-view .chat-welcome-title { font-family: var(--serif); font-weight: 400; font-size: 1.75rem; }
.forge-shell .chat-view .chat-empty-state-card { margin-top: 8px; }

/* The task selector, its chip and its menu. */
.chat-task-anchor { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.chat-task-toggle, .chat-task-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--accent-line); background: var(--card); color: var(--tx-2); font-size: 12.5px; font-weight: 600;
}
.chat-task-chip { background: var(--accent-soft); color: var(--accent-soft-ink); }
.chat-task-clear { border: 0; background: none; color: inherit; font-size: 14px; line-height: 1; padding: 0 2px; cursor: pointer; }
.chat-task-menu {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 30; width: min(440px, 86vw); max-height: 70vh; overflow: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); box-shadow: var(--sh);
}
.chat-task-menu[hidden] { display: none; }
.chat-task-menu-head { display: flex; justify-content: space-between; gap: 12px; padding: 4px 8px 8px; color: var(--tx-3); font-size: 11.5px; }
.chat-task-item {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-xs);
  background: none; text-align: left; color: var(--tx); cursor: pointer;
}
.chat-task-item:hover, .chat-task-item:focus-visible, .chat-task-item.is-selected { background: var(--accent-soft); }
.chat-task-item-label { font-weight: 600; font-size: 13.5px; }
.chat-task-item-hint { grid-column: 1; color: var(--tx-3); font-size: 12px; }
.chat-task-item-badge { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--tx-3); font-size: 11px; }
.chat-task-more { margin-top: 4px; border-top: 1px solid var(--line); }
.chat-task-more summary { padding: 8px 10px; color: var(--accent); font-weight: 600; cursor: pointer; }
.chat-task-more-list { display: grid; gap: 2px; padding: 0 4px 6px; }
.chat-task-more-item { padding: 7px 10px; border: 0; border-radius: var(--r-xs); background: none; text-align: left; color: var(--tx); cursor: pointer; }
.chat-task-more-item:hover, .chat-task-more-item:focus-visible { background: var(--accent-soft); }
.chat-task-more-head { margin: 8px 10px 2px; color: var(--tx-3); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* The undoable mode switch. */
.chat-mode-switch-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; padding: 7px 11px; border: 1px solid var(--accent-line); border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent-soft-ink); font-size: 12.5px; }
.chat-mode-switch-undo { border: 0; background: none; color: var(--accent); font-weight: 600; text-decoration: underline; cursor: pointer; }

/* The maintenance form (pack.cyber only). */
.chat-task-form { margin: 0 0 10px; padding: 14px 16px; border: 1px solid var(--accent-line); border-radius: var(--r-sm); background: var(--card); }
.chat-task-form-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.chat-task-form-head h3 { margin: 0; font-size: 14px; }
.chat-task-form-head span { color: var(--tx-3); font-size: 12px; }
.chat-task-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.chat-task-form-grid .is-wide { grid-column: 1 / -1; }
.chat-task-field { display: grid; gap: 4px; font-size: 12px; color: var(--tx-2); font-weight: 600; }
.chat-task-field input { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-xs); background: var(--paper); font: inherit; font-weight: 400; color: var(--tx); }
.chat-task-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chat-task-tones { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--tx-2); font-weight: 600; }
.chat-task-tone { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 12.5px; cursor: pointer; }
.chat-task-tone.is-selected { border-color: var(--accent); background: var(--accent); color: var(--paper); }
.chat-task-form-note { margin: 10px 0 0; color: var(--tx-3); font-size: 12px; }
/* Lot W (TV-10): the form is sent by its own button. */
.chat-task-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.chat-task-form-foot .chat-task-form-note { margin: 0; }

/* « Confier à un agent » and the context gauge, in the bar. */
.chat-delegate { position: relative; }
.chat-delegate.is-hidden { display: none; }
.chat-delegate-toggle { padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r-xs); background: var(--card); color: var(--tx); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chat-delegate-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(360px, 86vw); padding: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); box-shadow: var(--sh); }
.chat-delegate-menu[hidden] { display: none; }
.chat-delegate-head { margin: 4px 8px 8px; color: var(--tx-3); font-size: 11.5px; }
.chat-delegate-item { display: grid; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-xs); background: none; text-align: left; cursor: pointer; }
.chat-delegate-item:hover, .chat-delegate-item:focus-visible { background: var(--accent-soft); }
.chat-delegate-name { font-weight: 600; color: var(--tx); font-size: 13px; }
.chat-delegate-does { color: var(--tx-3); font-size: 12px; }
.chat-context-gauge { display: inline-flex; align-items: center; gap: 8px; color: var(--tx-3); font-size: 12px; }
.chat-context-gauge.is-hidden { display: none; }
.chat-context-gauge-bar { width: 80px; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.chat-context-gauge-fill { display: block; height: 100%; background: var(--accent); }

/* Conversations: grouped by date, one line each, details on hover. */
.forge-shell .chat-conversations-list .conversation-item { position: relative; }
.forge-shell .chat-conversations-list .conversation-main { display: flex; align-items: center; gap: 8px; width: 100%; }
.conversation-mode-icon { flex: none; width: 18px; color: var(--tx-3); text-align: center; }
.conversation-mode-icon.is-general { color: var(--mode-general, var(--accent)); }
.forge-shell .chat-conversations-list .conversation-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-hover {
  display: none; position: absolute; left: calc(100% - 12px); top: 0; z-index: 25; width: 280px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); box-shadow: var(--sh);
}
.conversation-item:hover .conversation-hover, .conversation-item:focus-within .conversation-hover { display: block; }
.conversation-hover-title { margin: 0 0 8px; font-weight: 600; color: var(--tx); }
.conversation-hover-details { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: 12.5px; }
.conversation-hover-details dt { color: var(--tx-3); }
.conversation-hover-details dd { margin: 0; color: var(--tx-2); }
/* Lot W (TV-11): fixed layers, placed by the page next to their line. */
.forge-shell .chat-conversations-list .conversation-hover { position: fixed; left: 0; top: 0; }
.forge-shell .chat-conversations-list .conversation-item.is-menu-open .conversation-hover { display: none; }
.forge-shell .chat-conversations-list .conversation-item { display: flex; flex-direction: row; align-items: center; }
.forge-shell .chat-conversations-list .conversation-main { flex: 1 1 auto; min-width: 0; }
.conversation-menu-button {
  flex: none; width: 26px; height: 26px; margin-right: 4px; border: 0; border-radius: 6px; background: none;
  color: var(--tx-3); font-size: 16px; line-height: 1; cursor: pointer; opacity: 0;
}
.conversation-item:hover .conversation-menu-button, .conversation-item.is-menu-open .conversation-menu-button,
.conversation-menu-button:focus-visible { opacity: 1; }
.conversation-menu-button:hover, .conversation-item.is-menu-open .conversation-menu-button { background: var(--card-2, var(--line)); color: var(--tx); }
.conversation-menu {
  position: fixed; z-index: 40; display: flex; flex-direction: column; min-width: 180px; padding: 6px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); box-shadow: var(--sh);
}
.conversation-menu[hidden] { display: none; }
.conversation-menu button { padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--tx); text-align: left; font-size: 13px; cursor: pointer; }
.conversation-menu button:hover, .conversation-menu button:focus-visible { background: var(--card-2, var(--line)); }
.conversation-archives-toggle { margin-top: 10px; padding: 8px 10px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--tx-2); text-align: left; width: 100%; cursor: pointer; }

/* The question's task, the answer's actions, the sources by title. */
.chat-message-task { display: block; margin-bottom: 4px; color: var(--accent); font-size: 12px; font-weight: 600; }
.message-actions-line { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 6px; opacity: .55; transition: opacity .15s ease; }
.chat-message:hover .message-actions-line, .message-actions-line:focus-within { opacity: 1; }
.message-actions-line .message-copy-actions, .message-actions-line .message-feedback { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.message-sources { margin-top: 10px; }
.message-sources-label { margin: 0 0 6px; color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.message-sources .message-inline-sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.message-sources .source-snippet { display: none; }
.source-file { font-family: var(--mono, ui-monospace, monospace); font-size: 11px; }
.todo-mark { padding: 0 3px; border-radius: 3px; background: var(--warn-bg, #fff1c9); color: var(--warn, #7a5a12); font-weight: 600; }
.todo-mark sup { font-size: .7em; margin-left: 1px; }

/* The T avatar of the Assistant. */
.forge-shell .chat-message.assistant .chat-message-role::before {
  content: ''; display: inline-block; width: 22px; height: 22px; margin-right: 8px; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card) url('/src/brand/favicon/favicon.svg') center / 12px no-repeat;
}

/* The abstention, the missing questions, the full conversation. */
.chat-abstention { padding: 12px 14px; border: 1px dashed var(--accent-line); border-radius: var(--r-sm); background: repeating-linear-gradient(135deg, transparent 0 10px, var(--accent-soft) 10px 11px); }
.chat-abstention-title { margin: 0 0 6px; font-weight: 600; color: var(--tx); }
.chat-abstention-ways { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-questions-card, .chat-context-full { margin: 12px 0; padding: 14px 16px; border: 1px solid var(--accent-line); border-radius: var(--r-sm); background: var(--card); }
.chat-questions-card h3, .chat-context-full h3 { margin: 0 0 4px; font-size: 14.5px; }
.chat-questions-intro { margin: 0 0 8px; color: var(--tx-2); font-size: 12.5px; }
.chat-questions-list { margin: 0 0 10px; padding-left: 20px; }
.chat-questions-reply { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-xs); background: var(--paper); font: inherit; }
.chat-questions-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; color: var(--tx-3); font-size: 12px; }
.chat-context-full-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-orientation-model { border-color: var(--accent-line); }

@media (max-width: 760px) {
  .chat-task-form-grid { grid-template-columns: 1fr; }
  .chat-task-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .conversation-hover { left: 12px; top: 100%; width: calc(100% - 24px); }
  .chat-questions-foot { flex-direction: column; align-items: stretch; }
}

/* Paramètres › Réponses › « Conservation des conversations ». */
.assistant-retention { margin: 0; padding: 0; }
.assistant-retention-intro, .assistant-retention-note { color: var(--tx-3); font-size: 12.5px; }
.assistant-retention-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 10px 0; }
.assistant-retention-field { display: grid; gap: 4px; font-size: 12.5px; color: var(--tx-2); font-weight: 600; }
.assistant-retention-actions { display: flex; align-items: center; gap: 10px; }
@media (max-width: 760px) { .assistant-retention-grid { grid-template-columns: 1fr; } }

/* Aligned on the maquettes of 01/10 (~/echange/lot-T-maquettes). */
/* The page title comes back above the frame: « Assistant » and one line. */
.forge-shell #chat-view .chat-page-header {
  position: static; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; white-space: normal;
  display: flex; align-items: baseline; gap: 14px; margin: 0 0 14px; padding: 0; border: 0; background: none;
}
.forge-shell #chat-view .chat-page-header > div { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.forge-shell #chat-view .chat-page-header h1 { margin: 0; font-size: 28px; }
.forge-shell #chat-view .chat-page-header p { margin: 0; color: var(--tx-3); font-size: 13px; }

/* One line per conversation: the mode's icon, the title cut. */
.forge-shell #chat-view .chat-conversations-list .conversation-item { display: flex; flex-direction: row; align-items: center; }
.forge-shell #chat-view .chat-conversations-list .conversation-main {
  flex-direction: row; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px;
  color: var(--tx-2); font-size: 13.5px; text-align: left;
}
.forge-shell #chat-view .chat-conversations-list .conversation-mode-icon { width: 16px; font-size: 12px; opacity: .7; }
.forge-shell #chat-view .chat-conversations-list .conversation-title { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 400; color: inherit; }
.forge-shell #chat-view .chat-conversations-list .conversation-item.is-active .conversation-title { font-weight: 600; }
/* The details show on hover or on keyboard focus, not after a click. */
.forge-shell #chat-view .conversation-item:focus-within:not(:has(:focus-visible)):not(:hover) .conversation-hover { display: none; }
.forge-shell #chat-view .conversation-hover { left: calc(100% - 20px); }
.forge-shell #chat-view .chat-conversations-panel { overflow: visible; }

/* The sources: the title first, the file in small, « Lire le passage » as a link. */
.forge-shell #chat-view .message-sources .source-item {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 9px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.forge-shell #chat-view .message-sources .source-ref {
  display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border-radius: 6px;
  font-family: var(--sans); font-size: 11px;
}
.forge-shell #chat-view .message-sources .source-badge-row:not(:has(.source-availability)) { display: none; }
.forge-shell #chat-view .message-sources .source-badge { display: none; }
.forge-shell #chat-view .message-sources .source-item h3 {
  margin: 0; font-family: var(--sans); font-size: 13.5px; font-weight: 600; line-height: 1.35; word-break: normal; overflow-wrap: anywhere;
}
.forge-shell #chat-view .message-sources .source-meta { margin: 1px 0 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11.5px; }
.forge-shell #chat-view .message-sources .source-read-button {
  min-height: 0; margin-top: 3px; padding: 0; border: 0; background: none; box-shadow: none;
  color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.forge-shell #chat-view .message-sources .source-read-button:hover { text-decoration: underline; background: none; }

/* « Confier à un agent » on one line; the reply language as a small icon. */
.forge-shell #chat-view .chat-delegate-toggle { white-space: nowrap; }
.forge-shell #chat-view .chat-reply-language { gap: 3px; padding: 0 4px; border: 0; background: none; box-shadow: none; }
.forge-shell #chat-view .chat-reply-language select {
  width: auto; min-width: 0; padding: 2px 2px; border: 0; background: none; box-shadow: none;
  color: var(--tx-3); font-size: 11.5px; font-weight: 600; appearance: none; -webkit-appearance: none; cursor: pointer;
}

/* The task menu opens towards the free space (main.js sets is-down). */
.chat-task-menu.is-down { top: calc(100% + 8px); bottom: auto; }
.chat-task-item-badge { font-weight: 600; }

/* The welcome moved up: under the bar, not in the middle of the frame. */
.forge-shell #chat-view:not(:has(#answer-card[data-has-answer="true"])) .answer-card { margin-top: 0; padding-top: 34px; }
/* The large title in the serif (the page title alone takes Jost). */
.forge-shell #chat-view .chat-empty-state-card h3.chat-welcome-title { font-family: 'Newsreader', Georgia, serif; font-size: 26px; font-weight: 500; }
.chat-task-menu-head > span:first-child { color: var(--accent-text); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.forge-shell #chat-view .message-actions-line button { min-height: 0; padding: 3px 7px; border: 0; border-radius: 7px; background: none; box-shadow: none; color: var(--tx-3); font-size: 12.5px; font-weight: 500; }
.forge-shell #chat-view .message-actions-line button:hover { background: var(--card-2); color: var(--tx); }
.forge-shell #chat-view .chat-context-gauge > span:first-child { white-space: nowrap; }
/* Phone width: the bar wraps instead of widening the frame. */
@media (max-width: 720px) {
  .forge-shell #chat-view .chat-panel-header { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; row-gap: 8px; }
  .forge-shell #chat-view .chat-panel-header > .chat-bar-title { flex: 1 1 100%; min-width: 0; }
  .forge-shell #chat-view .chat-panel-header > .chat-header-actions { flex: 1 1 100%; }
  .forge-shell #chat-view .chat-header-actions, .forge-shell #chat-view .chat-base-select { min-width: 0; max-width: 100%; }
  .forge-shell #chat-view .chat-layout > * { min-width: 0; }
}
/* Phone width: the task menu as a sheet at the bottom of the screen. */
@media (max-width: 720px) {
  .chat-task-menu, .chat-task-menu.is-down { position: fixed; left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 72vh !important; z-index: 60; }
}
.chat-task-templates-empty { margin: 2px 10px 6px; color: var(--tx-3); font-size: 12px; line-height: 1.45; }

/* The bar of a started conversation: both modes, as on the maquettes; the
   conversation's title stays for assistive technology, the tag gives way. */
.forge-shell #chat-view .chat-bar-modes { display: none; }
.forge-shell #chat-view:has(#answer-card[data-has-answer="true"]) .chat-bar-modes {
  display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card-2); flex: 0 0 auto;
}
.forge-shell #chat-view .chat-bar-mode {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: 999px; background: none;
  color: var(--tx-3); font-size: 12.5px; font-weight: 500; white-space: nowrap; opacity: 1;
}
.forge-shell #chat-view .chat-bar-mode:disabled { cursor: default; }
.forge-shell #chat-view .chat-bar-mode.is-active { background: var(--accent); color: var(--paper); font-weight: 600; }
.forge-shell #chat-view:has(#answer-card[data-has-answer="true"]) .chat-bar-title h2,
.forge-shell #chat-view .chat-bar-title .chat-grounding-badge {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
