/* Conversation coordination follows the shared Telegram blue controls and focus outline. */
.iw-page { min-width: 0; }
.iw-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; }
.iw-heading h1 { font-size:22px; line-height:1.3; margin:4px 0 0; }
.iw-heading .row { flex-wrap:wrap; justify-content:flex-end; }
.iw-heading .eyebrow { color:var(--muted); font-size:10px; letter-spacing:.14em; }
.iw-heading .iw-next { color:#086b95; background:#e8f5fc; border-color:#b8ddee; font-weight:600; white-space:normal; }
.iw-heading .iw-next:hover { background:#d8eef9; }
.iw-send-status { flex-shrink:0; padding:8px 14px; border-top:1px solid #dbe7ef; background:#f8fcff; max-height:160px; overflow:auto; font-size:12px; }
.iw-send-pending { margin:0; color:#226987; }
.iw-send-failure { padding:6px 0; color:#87580e; }
.iw-send-failure summary { cursor:pointer; font-weight:600; }
.iw-send-failure p { margin:6px 0; }
.iw-unsent-text { white-space:pre-wrap; overflow-wrap:anywhere; color:var(--text); }
.iw-page .chat-grid { height:calc(100vh - 175px); min-height:560px; }
/* Fit the inbox to the space left by the actual header, including wrapped titles.
   Scroll conversations and tools internally instead of pushing the composer off screen. */
@media (min-width: 761px) {
  .workspace:has(.iw-page) { height:100dvh; min-height:0; }
  .main:has(.iw-page) { display:flex; flex-direction:column; height:100dvh; min-height:0; }
  .main:has(.iw-page) > .topbar { flex-shrink:0; }
  .main:has(.iw-page) > .wrap { display:flex; flex-direction:column; flex:1; min-height:0; width:100%; padding-bottom:16px; }
  .main:has(.iw-page) .workspace-footer { display:none; }
  .main:has(.iw-page) .setup { flex-shrink:0; max-height:25%; overflow:auto; }
  .main:has(.iw-page) #view { display:flex; flex-direction:column; flex:1; min-height:0; }
  .iw-page { display:flex; flex-direction:column; flex:1; min-height:0; }
  .iw-heading { flex-shrink:0; }
  .iw-page .chat-grid { flex:1; height:auto; min-height:0; grid-template-rows:minmax(0,1fr); }
  .iw-page .conv { height:auto; min-height:0; }
  .iw-page .msgs { min-height:0; }
  .iw-page .composer, .iw-page .reply-to { flex-shrink:0; }
  .iw-page .notes-bar { max-height:18%; overflow:auto; flex-shrink:0; }
  .iw-page .inbox-list { max-height:none; }
  .iw-page .rail { flex-direction:column; flex-wrap:nowrap; overflow-y:auto; min-height:0; }
  .iw-page .rail button { flex-shrink:0; min-width:0; }
  .iw-page #tool { min-height:0; }
}
.iw-page .inbox { min-height:0; display:flex; flex-direction:column; }
.iw-page .inbox-heading { display:flex; align-items:center; justify-content:space-between; padding:15px 14px 10px; font-weight:700; }
.iw-page .inbox > input,.iw-page .inbox > select { width:calc(100% - 24px); margin:0 12px 9px; min-width:0; font-size:14px; }
.iw-page .inbox-list { flex:1; min-height:0; }
.iw-queue { display:flex; flex-wrap:wrap; gap:5px; padding:0 12px 12px; }
.iw-queue button { border:1px solid transparent; border-radius:7px; padding:6px 8px; color:#455d6e; background:#f0f5f9; font-size:12px; font-weight:600; cursor:pointer; }
.iw-queue button:hover { background:#e2f1fd; color:#167fbc; }
.iw-queue button.on { background:#dcefff; border-color:#b8dcf7; color:#076fae; }
.iw-page .ci { display:grid; grid-template-columns:36px minmax(0,1fr); column-gap:10px; row-gap:5px; width:100%; text-align:left; padding:12px; margin:0; border:0; border-bottom:1px solid #eaf0f5; border-radius:0; color:inherit; font:inherit; background:white; cursor:pointer; }
.iw-page .ci:hover { background:#f4faff; }
.iw-page .ci.on { background:#e9f5ff; box-shadow:inset 3px 0 #229ed9; }
.iw-page .ci:disabled { cursor:wait; opacity:.65; }
.iw-chat-name { display:flex; align-items:center; gap:6px; min-width:0; min-height:19px; }
.iw-chat-name b { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14px; }
.iw-page .ci>.contact-avatar { grid-row:1 / span 2; align-self:center; width:36px; height:36px; border-radius:10px; display:grid; place-items:center; font-size:15px; }
.iw-card-meta { grid-column:2; display:flex; align-items:center; justify-content:space-between; gap:10px; min-width:0; line-height:19px; }
.iw-account { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#6c7f8d; font-size:10px; }
.iw-owner { display:inline-flex; align-items:center; gap:4px; min-width:0; max-width:45%; flex-shrink:0; color:#526a7c; font-size:12px; }
.iw-owner>span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.iw-owner .iw-presence { flex-shrink:0; margin:0; }
.iw-vip { display:inline-flex; align-items:center; gap:3px; flex-shrink:0; color:#623507; background:#fbbf24; border:1px solid #e8a30b; border-radius:6px; padding:1px 6px; font-size:10px; font-weight:800; line-height:16px; letter-spacing:.04em; }
.iw-vip>svg { width:11px; height:11px; flex-shrink:0; stroke-width:2; }
.iw-chat-name .dot { flex-shrink:0; }
.iw-card-alerts { grid-column:1 / -1; display:flex; flex-wrap:wrap; align-items:center; gap:4px 6px; margin-top:3px; }
.iw-wait { display:inline-block; background:#fff2db; color:#945d07; padding:3px 6px; border-radius:5px; font-size:10px; font-weight:600; }
.iw-card-alerts .iw-wait { padding:2px 6px; font-size:11px; line-height:16px; }
.iw-followup-date,.iw-transfer-label { color:#497a98; font-size:9px; line-height:14px; padding:2px 5px; background:#f0f6fa; border-radius:4px; }
.iw-claim-label { color:#0988cb; font-weight:600; }
.iw-person { display:inline-flex; align-items:center; gap:7px; min-width:0; }
.iw-person > span:last-child { min-width:0; }
.iw-person b { display:block; font-size:13px; line-height:1.3; overflow:hidden; text-overflow:ellipsis; max-width:160px; white-space:nowrap; }
.iw-person small { display:block; color:#526a7c; font-size:12px; margin-top:2px; white-space:nowrap; }
.iw-page .iw-person .avatar-sm,.iw-dialog .avatar-sm { width:27px; height:27px; flex-shrink:0; font-size:11px; border-radius:50%; object-fit:cover; background:#dfeef8; color:#197aac; display:inline-grid; place-items:center; }
.iw-presence { width:6px; height:6px; display:inline-block; border-radius:50%; background:#a0aeb9; margin-right:3px; vertical-align:middle; }
.iw-presence.available { background:#39a977; }
.iw-presence.paused { background:#eba634; }
.iw-pages { padding:9px 10px; display:flex; justify-content:space-between; align-items:center; gap:7px; border-top:1px solid #e5edf3; font-size:10px; color:#708594; }
.iw-pages .btn { padding:3px 9px; }
#iw-list-error .warnbox { margin:6px 10px; font-size:11px; }
.iw-empty { padding:25px 15px; color:#788895; font-size:12px; text-align:center; }
.iw-coordination { flex-shrink:0; padding:8px 14px; border-bottom:1px solid #e1edf5; background:#f8fcff; display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.iw-assignees { display:flex; flex-wrap:wrap; gap:16px; flex:1; }
.iw-coordination-actions { display:flex; flex-wrap:wrap; gap:5px; }
.iw-coordination-actions .btn { font-size:10px; padding:5px 7px; }
.iw-handoff-strip { flex-basis:100%; padding:7px 9px; margin-top:4px; border-radius:6px; background:#e7f3fc; color:#397397; font-size:11px; }
.iw-typing { flex-shrink:0; padding:0 18px; min-height:0; color:#1985bd; font-size:11px; }
.iw-typing:not(:empty) { padding:7px 18px 0; }
.iw-attribution { display:flex; flex-direction:column; gap:3px; margin-top:8px; padding-top:7px; border-top:1px solid #d9e4ec; color:#526a7c; font-size:12px; line-height:1.45; overflow-wrap:anywhere; }
.iw-attribution b { font-weight:600; }
.iw-backdrop { position:fixed; inset:0; z-index:90; background:rgba(18,43,62,.34); padding:24px; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(3px); }
.iw-dialog { width:min(620px,100%); max-height:calc(100dvh - 48px); border-radius:16px; background:#fff; border:1px solid #d8e6ef; box-shadow:0 22px 80px rgba(19,54,76,.2); display:flex; flex-direction:column; outline:none; }
.iw-dialog:focus { outline:none; }
.iw-dialog > header { padding:19px 22px; border-bottom:1px solid #e6eef4; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.iw-dialog h2 { margin:4px 0 0; font-size:20px; }
.iw-dialog .eyebrow { font-size:9px; letter-spacing:.13em; color:#6c879a; }
.iw-dialog-body { padding:20px 22px; overflow:auto; overscroll-behavior:contain; min-height:0; }
.iw-dialog-body > p:first-child { margin-top:0; }
.iw-dialog p { line-height:1.55; }
.iw-dialog .row { flex-wrap:wrap; }
.iw-form fieldset { display:flex; flex-direction:column; gap:14px; border:0; padding:0; margin:0 0 16px; min-width:0; }
.iw-form label { display:flex; flex-direction:column; gap:6px; font-size:12px; font-weight:600; color:#415e73; min-width:0; }
.iw-form input,.iw-form textarea,.iw-form select { width:100%; min-width:0; font-weight:400; }
.iw-form textarea { resize:vertical; min-height:65px; }
.iw-form fieldset:disabled { opacity:.75; }
.iw-form .warnbox { font-size:12px; }
.iw-form-footer { margin-top:14px; }
.iw-switch { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:16px; }
.iw-handoff-list { display:flex; flex-direction:column; gap:12px; margin:14px 0; }
.iw-handoff-card,.iw-shift-chat { border:1px solid #e0eaf2; border-radius:10px; padding:14px; background:#fbfdff; }
.iw-handoff-card p { margin:7px 0; }
.iw-handoff-card .badge { margin-left:auto; font-size:10px; }
.iw-note-text { white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; }
.iw-note-list { max-height:35vh; overflow:auto; border:1px solid #e1ebf3; border-radius:10px; padding:12px; margin:14px 0 18px; background:#f8fbfd; overscroll-behavior:contain; }
.iw-thread-note { padding:12px 0; border-bottom:1px solid #e3edf4; }
.iw-thread-note:last-child { border-bottom:0; }
.iw-thread-note .row { gap:7px; font-size:11px; }
.iw-thread-note time { margin-left:auto; font-size:10px; }
.iw-thread-note .iw-note-text { margin:8px 0; }
.iw-thread-note:target { background:#e8f5ff; }
.iw-mention-tags { display:flex; flex-wrap:wrap; gap:5px; }
.iw-mention-tags span { background:#e0f0fd; color:#2586bd; padding:3px 6px; border-radius:4px; font-size:10px; }
.iw-mentions-picker { border:1px solid #e2ebf2; border-radius:7px; padding:9px; font-size:11px; }
.iw-mentions-picker summary { cursor:pointer; color:#3d7698; }
.iw-mentions-picker > div { display:flex; flex-wrap:wrap; gap:9px; margin-top:10px; }
.iw-mentions-picker label { display:inline-flex; flex-direction:row; align-items:center; gap:6px; font-size:11px; }
.iw-mentions-picker input { width:auto; }
.iw-shift-chats { display:flex; flex-direction:column; gap:12px; }
.iw-shift-chat label { margin-top:12px; }
.iw-shift-chat .iw-wait { margin-top:8px; }
.iw-shift-success { text-align:center; padding:12px 20px 22px; }
.iw-shift-success > span { display:inline-grid; place-items:center; width:48px; height:48px; border-radius:50%; background:#e1f4ed; color:#29966f; font-size:25px; }
.iw-shift-success h3 { font-size:20px; }
.iw-heading #iw-handoff-count:not(:empty),.iw-heading #iw-mention-count:not(:empty) { padding:2px 5px; min-width:17px; border-radius:4px; background:#e3f1fc; color:#087dbb; font-size:10px; }
.iw-page .sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media(max-width:1100px) { .iw-heading { align-items:flex-start; }.iw-heading h1 { font-size:18px; }.iw-heading .row { gap:5px; }.iw-heading .btn { font-size:11px; padding:6px 8px; }.iw-coordination-actions { flex-basis:100%; }.iw-page .chat-grid { grid-template-columns:240px minmax(0,1fr) auto 58px; } }
@media(max-width:760px) { .iw-heading { flex-direction:column; gap:10px; }.iw-heading .row { justify-content:flex-start; }.iw-page .chat-grid { height:auto; min-height:0; grid-template-columns:minmax(0,1fr); }.iw-page .inbox { max-height:420px; }.iw-page .conv { height:auto; min-height:0; max-height:none; }.iw-page .msgs { flex:none; height:50dvh; min-height:260px; max-height:65dvh; }.iw-page .rail { flex-direction:row; overflow-x:auto; border-top:1px solid #dbe7ef; }.iw-page .rail button { flex-shrink:0; }.iw-coordination { padding:10px; }.iw-page #tool .tool { width:100%; }.iw-backdrop { padding:10px; }.iw-dialog { max-height:calc(100dvh - 20px); border-radius:12px; }.iw-dialog > header { padding:14px 16px; }.iw-dialog-body { padding:15px 16px; }.iw-dialog h2 { font-size:18px; }.iw-note-list { max-height:32vh; } }

/* Apercu du dernier message, a la place du nom du compte : celui-ci etait le meme sur toutes
   les lignes et n'aidait a reconnaitre personne. Une seule ligne, coupee proprement — c'est
   un indice pour retrouver une conversation, pas le message lui-meme. */
.iw-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color:#526a7c; min-width: 0; font-size:13px; }
.iw-preview i { font-style: normal; opacity: .7; }

/* L'identifiant Telegram a cote du nom. Les deux different chez presque tout le monde — on
   cherche quelqu'un par son @, on le reconnait par son nom : il faut les deux, et le @
   s'efface le premier quand la place manque. */
.iw-handle { color: var(--muted); font-weight: 400; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

@media(max-width:1100px) { .iw-coordination-actions { order:3; } }
@media(max-width:760px) { .iw-coordination>.conversation-handling { width:100%; justify-content:space-between; }.iw-coordination .conversation-handle { flex:1; } }
@media(max-width:760px) {
  .conversation-compose .composer { flex-wrap:wrap; padding:10px; }
  .conversation-compose .composer textarea { flex:1 0 100%; min-width:0; height:72px; }
  .conversation-compose .qr-composer-button { margin-left:auto; }
  .conversation-compose #chat-send { min-width:84px; }
}

/* Conversation action launcher and focused tool workspace. */
.iw-page .chat-grid { position:relative; grid-template-columns:258px minmax(0,1fr) auto; }
.iw-page #tool:empty { display:none; }
.iw-page .chat-grid:has(#tool:not(:empty)) > .rail { display:none; }
.iw-page .rail { width:248px; padding:16px 12px; gap:14px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.actions-heading { padding:0 6px 2px; }
.actions-heading h2 { font-size:17px; line-height:1.3; margin:0 0 6px; }
.actions-heading p { color:#607487; font-size:12px; line-height:1.5; margin:0; overflow-wrap:anywhere; }
.action-group h3 { color:#617586; font-size:10px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; margin:0 6px 8px; }
.iw-page .rail .action-item { width:100%; display:flex; flex-direction:row; align-items:center; text-align:left; gap:8px; padding:9px 7px; border-radius:8px; border:1px solid transparent; color:#223e51; margin:3px 0; }
.action-item .action-icon { width:24px; height:30px; display:grid; place-items:center; color:#668093; flex-shrink:0; }
.action-icon svg { width:21px; height:21px; }
.action-item .action-copy { flex:1; min-width:0; }
.action-copy strong { display:block; font-size:13px; line-height:1.4; font-weight:650; }
.action-copy small { display:block; font-size:11px; line-height:1.5; color:#63798b; margin-top:3px; }
.action-item .action-arrow { display:none; }
.iw-page .rail .action-primary { background:#ebf6fd; border-color:#cde7f6; color:#086b9c; }
.action-primary .action-icon { color:#0a82b7; }
.iw-page .rail .action-item:hover:not(:disabled) { background:#edf5fa; border-color:#c4dce9; }
.iw-page .rail .action-item:disabled { opacity:.5; cursor:not-allowed; }
.iw-page .rail .action-item:focus-visible,.tool-back:focus-visible,.tool-disclosure summary:focus-visible { outline:2px solid #0683b9; outline-offset:-2px; }
.iw-page #tool { min-width:0; }
.iw-page #tool .tool { width:370px; border-radius:12px; padding:0 18px 18px; background:#fff; }
.tool-header { position:sticky; top:0; z-index:3; background:#fff; margin:0 -18px 18px; padding:14px 18px 16px; border-bottom:1px solid #e4edf3; }
.tool-back { display:flex; align-items:center; gap:8px; padding:4px 0; margin-bottom:12px; font-size:12px; font-weight:600; color:#42738e; border:0; background:none; cursor:pointer; }
.tool-back:hover { color:#087bad; }
.tool-header h2 { font-size:19px; line-height:1.3; margin:0 0 5px; }
.tool-header h2:focus { outline:none; }
.tool-header p { font-size:12px; color:#63798b; margin:0; line-height:1.5; }
.offer-step { margin:0 0 20px; min-width:0; }
.offer-step h3 { font-size:14px; line-height:1.4; margin:0 0 14px; display:flex; align-items:center; gap:9px; }
.offer-step h3 > span { display:grid; place-items:center; width:24px; height:24px; border-radius:50%; background:#e8f4fc; color:#187da8; font-size:11px; flex-shrink:0; }
.offer-step-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.offer-step-heading .btn { font-size:10px; padding:5px 7px; }
.offer-step .chips { margin:8px 0; }
.offer-step .f { min-width:0; }
.offer-step .f input { min-width:0; }
.tool-disclosure { margin:12px 0; border:1px solid #e0e9f0; border-radius:8px; background:#f8fbfd; }
.tool-disclosure > summary { cursor:pointer; font-size:12px; font-weight:600; padding:11px 12px; color:#385b70; }
.tool-disclosure-body { padding:0 12px 12px; }
.tool-disclosure-body .suggest { padding:0; margin:8px 0; border:0; background:none; }
.tool-empty { text-align:center; padding:20px 8px; color:#607487; font-size:13px; }
.tool-empty .btn { margin-top:10px; }
.offer-prepare { border-top:1px solid #dfe9f0; padding-top:20px; }
.offer-step { scroll-margin-top:135px; }
.offer-selection { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:12px 0 8px; }
.offer-selection > span { font-size:12px; font-weight:600; color:#45647a; }
.offer-selection .btn { font-size:12px; }
.offer-prepare > .tool-back { margin-top:10px; }
.offer-send { display:flex; flex-direction:column; gap:8px; }
.offer-send .btn { min-height:40px; }
.iw-page #tool .tool.full { width:auto; max-width:960px; margin:auto; height:calc(100dvh - 40px)!important; }
@media(min-width:1251px) and (max-width:1450px) {
  .iw-page .chat-grid { grid-template-columns:232px minmax(0,1fr) auto; gap:12px; }
  .iw-page .rail { width:248px; }
  .iw-page #tool .tool:not(.full) { width:370px; }
}
/* On laptops, actions sit above the chat. Opening a tool overlays only that column. */
@media(min-width:761px) and (max-width:1250px) {
  .iw-page .chat-grid { grid-template-columns:220px minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
  .iw-page .inbox { grid-column:1; grid-row:1 / 3; }
  .iw-page .conv { grid-column:2; grid-row:2; }
  .iw-page .rail { grid-column:2; grid-row:1; width:auto; padding:10px; display:block; overflow:visible; }
  .actions-heading { display:none; }
  .action-group { display:contents; }
  .action-group h3,.action-copy small,.action-arrow { display:none; }
  .iw-page .rail .action-item { display:inline-flex; width:auto; padding:6px 8px; margin:2px; gap:5px; }
  .action-item .action-icon { width:18px; height:20px; }
  .action-icon svg { width:17px; height:17px; }
  .action-copy strong { font-size:12px; }
  .iw-page .chat-grid:has(#tool:not(:empty)) .conv { grid-row:1 / 3; }
  .iw-page #tool:not(:empty) { position:absolute; inset:0 0 0 auto; width:min(420px,calc(100% - 230px)); z-index:8; }
  .iw-page #tool .tool:not(.full) { width:100%; box-shadow:-12px 0 28px #133b501f; }
}
@media(max-width:760px) {
  .iw-page .chat-grid { display:flex; flex-direction:column; }
  .iw-page .rail { width:100%; display:block; padding:14px; }
  .iw-page .rail .action-group { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; margin-top:12px; }
  .action-group h3 { grid-column:1 / -1; }
  .iw-page .rail .action-item { padding:9px 6px; gap:5px; }
  .action-copy small { font-size:10px; }
  .action-copy strong { font-size:12px; }
  .action-item .action-icon { width:24px; }
  .action-item .action-arrow { display:none; }
  .iw-page #tool:not(:empty) { position:fixed; inset:12px; z-index:18; }
  .iw-page #tool .tool { width:100%; box-shadow:0 0 0 100vmax #132f4870; }
  .iw-page #tool .tool.full { inset:12px; height:calc(100dvh - 24px)!important; }
}
/* History stays readable; the composer is replaced by an explicit claim action. */
.iw-locked-conversation{display:flex;flex-direction:column;flex:1;min-height:0;height:100%;overflow:hidden}
.iw-locked-conversation>header{padding:16px 20px;border-bottom:1px solid var(--line);flex-shrink:0}
.iw-locked-conversation>header h2{margin:0 0 4px;font-size:18px}
.iw-locked-conversation .iw-locked-messages{flex:1;min-height:0;overflow:auto;padding:18px}
.iw-locked-composer{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:16px 20px;border-top:1px solid var(--line);background:#f1f8fd;flex-shrink:0}
.iw-lock-icon{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:#dcefff;color:#086b9e;flex-shrink:0}
.iw-lock-icon svg{width:20px;height:20px}
.iw-locked-composer>div{flex:1;min-width:150px}
.iw-locked-composer p{margin:4px 0 0;font-size:12px;color:#526a7c}
.iw-locked-composer>.warnbox{flex-basis:100%}
