/* Foyer — assistant */
.ask-hero { max-width: 820px; margin: 18px auto 30px; text-align: center; }
.ask-hero h1 { font-size: 28px; letter-spacing: -.02em; margin: 10px 0 22px; font-weight: 650; }
.ask-hero .alert { text-align: left; }
.ask-box { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 6px 24px rgba(16, 24, 40, .07); padding: 14px 64px 14px 20px; text-align: left; transition: border-color .15s, box-shadow .15s; }
.ask-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent), 0 6px 24px rgba(16, 24, 40, .07); }
.ask-box textarea { border: 0; outline: 0; resize: none; width: 100%; font: inherit; font-size: 16px; line-height: 1.5; padding: 4px 0; background: transparent; box-shadow: none; min-height: 28px; }
.ask-box textarea:focus { box-shadow: none; }
.ask-send { position: absolute; right: 10px; bottom: 10px; width: 42px; height: 42px; padding: 0; border-radius: 50%; justify-content: center; }
.ask-busy { display: none; align-items: center; gap: 10px; color: var(--text-2); font-size: 13.5px; padding: 8px 0 2px; }
form.is-busy .ask-busy { display: flex; }
form.is-busy textarea { opacity: .55; }
.ask-box.follow { margin: 18px auto 0; max-width: 860px; position: sticky; bottom: 16px; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.suggestions form { margin: 0; }
.suggestions .chip { cursor: pointer; background: #fff; font: inherit; font-size: 13px; padding: 6px 12px; }
.suggestions .chip:hover { border-color: var(--accent); color: var(--accent); }
.suggestions form.is-busy .chip { opacity: .5; }

.list-link { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.list-link:last-child { border-bottom: 0; }
.list-link:hover { text-decoration: none; color: var(--accent); }
.list-link > .ic { color: var(--muted); flex: none; }
.list-link > span:not(.badge) { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.list-link > span:not(.badge) small { color: var(--muted); font-size: 12px; }
.list-link .badge { flex: none; }

/* Fil de discussion */
.thread { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.page-head + .thread { margin-top: 4px; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-user .bubble { background: color-mix(in srgb, var(--accent) 10%, #fff); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 18px 18px 4px 18px; padding: 10px 16px; max-width: 80%; white-space: normal; }
.msg-assistant { display: flex; gap: 12px; align-items: flex-start; }
.assistant-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; margin-top: 2px; }
.answer { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 4px 18px 18px 18px; padding: 14px 18px; box-shadow: var(--shadow); }
.answer .md-body > :last-child { margin-bottom: 0; }
.answer .alert { margin: 0 0 10px; }
.answer-meta { display: flex; align-items: center; gap: 14px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.answer-meta .feedback { margin-left: auto; display: flex; gap: 2px; }
.answer-meta .feedback .btn { height: 28px; padding: 0 7px; color: var(--muted); }
.answer-meta .feedback .btn.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, #fff); }
.answer-chart { margin: 14px 0 4px; padding: 12px 14px 4px; border: 1px solid var(--border); border-radius: 12px; }
.answer-chart figcaption { margin-bottom: 6px; }
.doc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.doc-chips .chip { font-size: 12.5px; }
details.trace { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 10px; }
details.trace summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.trace-step { margin-top: 10px; padding: 10px 12px; background: #fafbfc; border: 1px solid var(--border); border-radius: 10px; }
.trace-step.failed { border-color: #f4c0ca; background: #fffafb; }
.trace-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 6px; font-size: 13px; }
.trace-head small { color: var(--muted); white-space: nowrap; }
.trace-step .md-code { margin: 0 0 8px; font-size: 12px; white-space: pre-wrap; }
.trace-step .table { font-size: 12.5px; background: #fff; }
.trace-step p { margin: 6px 0 0; }
.table-wrap { overflow-x: auto; }

/* Documents */
.upload-card { padding: 0; overflow: hidden; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px 20px; text-align: center; border: 2px dashed color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: var(--radius); margin: 14px; transition: background .15s, border-color .15s; }
.dropzone > .ic { color: var(--accent); }
.dropzone.over, .dropzone.has-files { background: color-mix(in srgb, var(--accent) 6%, #fff); border-color: var(--accent); }
.dropzone input[type=file] { max-width: 100%; font-size: 13px; }
.doc-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: #f2f4f7; color: var(--text-2); flex: none; }
.doc-ico.t-facture, .doc-ico.t-banque, .doc-ico.t-paie { background: #e7f6ec; color: #0e7a3c; }
.doc-ico.t-impots { background: #fff4e0; color: #9a5b00; }
.doc-ico.t-sante { background: #fdecef; color: #c4314b; }
.doc-ico.t-assurance, .doc-ico.t-contrat, .doc-ico.t-logement, .doc-ico.t-vehicule { background: #e8f1fb; color: #0f6cbd; }
.doc-ico.t-ecole { background: #f1ecfd; color: #6d3fd8; }
.summary-card h2 { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.summary-card p { font-size: 15px; line-height: 1.55; }
.kpis-inline { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 12px; }
.kpis-inline div { display: flex; flex-direction: column; }
.kpis-inline small { color: var(--muted); font-size: 12px; }
.kpis-inline strong { font-size: 18px; }
.doc-preview { padding: 10px; text-align: center; }
.doc-preview img { max-width: 100%; max-height: 900px; border-radius: 8px; }
.doc-text { white-space: pre-wrap; font: 12.5px/1.55 var(--mono); background: #fafbfc; border: 1px solid var(--border); border-radius: 8px; padding: 12px; max-height: 520px; overflow: auto; margin: 12px 0 0; }

/* Sources */
.tbl-row { padding: 14px 22px; border-top: 1px solid var(--border); }
.tbl-row.on { background: color-mix(in srgb, var(--accent) 3%, #fff); }
.tbl-check code { font-size: 13.5px; font-weight: 600; }
.tbl-cols { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 4px 28px; }
.col-chip { font: 11.5px var(--mono); background: #f2f4f7; border-radius: 5px; padding: 2px 6px; color: var(--text-2); display: inline-flex; align-items: center; gap: 3px; }
.col-chip.masked { background: var(--danger-bg); color: var(--danger); text-decoration: line-through; }
.tbl-fields { margin: 8px 0 0 28px; }
.tbl-fields .field { margin-bottom: 0; }
.tbl-row:not(.on) .tbl-fields { display: none; }
.budget-bar { height: 10px; border-radius: 6px; background: #eef0f3; overflow: hidden; margin: 6px 0; }
.budget-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.kv-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
textarea.mono { font-family: var(--mono); font-size: 12.5px; width: 100%; }
.render-kv p { margin: 12px 0 0; }

@media (max-width: 760px) {
  .ask-hero h1 { font-size: 22px; }
  .msg-user .bubble { max-width: 92%; }
  .assistant-avatar { display: none; }
  .tbl-cols, .tbl-fields { margin-left: 0; }
}
