/* Tacite Talk : bleu marine et sarcelle de Tacite-IA, police système, aplats (aucun dégradé). */
:root {
  --navy: #0b2545;
  --navy-2: #13355f;
  --ink: #0b1b2e;
  --text: #1a2433;
  --muted: #5a6677;
  --line: #e6ebf0;
  --soft: #f6f8fa;
  --teal: #0f766e;
  --teal-soft: #e6f4f2;
  --mint: #5eead4;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #9a4a07;
  --amber-soft: #fef3e2;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --ring: 0 0 0 4px rgba(15, 118, 110, .16);
  color-scheme: light;
}
* { box-sizing: border-box; min-width: 0; }
[hidden] { display: none !important; }
#app { height: 100%; }
html, body { margin: 0; height: 100%; background: #fff; color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px 15px; border: 0; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; box-shadow: 0 0 0 1px rgba(11, 27, 46, .1), 0 1px 2px rgba(11, 27, 46, .06); }
.btn:hover:not(:disabled) { box-shadow: 0 0 0 1px rgba(11, 27, 46, .18), 0 2px 6px -1px rgba(11, 27, 46, .1); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--navy); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 0 0 1px var(--navy); }
.btn.primary:hover:not(:disabled) { background: var(--navy-2); }
.btn.danger { background: var(--red); color: #fff; box-shadow: 0 0 0 1px var(--red); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--soft); color: var(--ink); }
.btn.small { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.btn.block { width: 100%; min-height: 44px; }
.btn.icon { width: 40px; padding: 0; font-size: 17px; }
.link { border: 0; background: none; color: #a9bbd0; padding: 0; font-size: 13px; text-decoration: underline; }
.input { width: 100%; min-height: 42px; padding: 10px 13px; border: 1px solid #dce3ea; border-radius: 11px; background: #f7f9fb; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.input:focus { background: #fff; border-color: var(--teal); box-shadow: var(--ring); }
.input.mono { font-family: var(--mono); letter-spacing: .04em; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink); }
.muted { color: var(--muted); }
.center { text-align: center; padding: 30px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 18px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.ext { background: var(--amber-soft); color: var(--amber); }

/* Accès */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--soft); }
.auth-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: 0 30px 70px -40px rgba(11, 37, 69, .45); }
.auth h1 { font-size: 24px; letter-spacing: -.02em; color: var(--ink); margin: 22px 0 8px; }
.auth .sub { color: var(--muted); margin: 0 0 20px; }
.error { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 17px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--navy); color: var(--mint); display: grid; place-items: center; font-weight: 800; }
.code { font-family: var(--mono); font-size: 21px; letter-spacing: .06em; text-align: center; padding: 18px 10px; border: 1px dashed var(--teal); border-radius: 14px; background: var(--teal-soft); color: var(--ink); margin-bottom: 10px; user-select: all; overflow-wrap: anywhere; }
.check { display: flex; gap: 10px; align-items: center; margin: 16px 0; font-size: 14px; }

/* Application */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100%; }
.side { background: var(--navy); color: #d8e3ef; display: flex; flex-direction: column; gap: 18px; padding: 18px 12px; overflow-y: auto; }
.org { padding: 4px 8px 12px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.org b { display: block; color: #fff; font-size: 16px; }
.org span { font-size: 13px; color: #9fb3c8; }
.group { display: grid; gap: 2px; }
.group-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 4px; }
.group-head small { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8fa4bd; }
.add { width: 24px; height: 24px; border: 0; border-radius: 7px; background: rgba(255, 255, 255, .08); color: #fff; font-size: 16px; line-height: 1; }
.add:hover { background: rgba(255, 255, 255, .18); }
.ch { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 9px; border: 0; border-radius: 8px; background: none; color: #c9d7e6; text-align: left; font-size: 14.5px; }
.ch span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch:hover { background: rgba(255, 255, 255, .07); }
.ch.on { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
.ch.unread { color: #fff; font-weight: 700; }
.ch .ext { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #fde7c4; color: #7a3b06; }
.ch .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); }
.foot { margin-top: auto; display: grid; gap: 8px; padding: 10px 8px 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.lock { font-size: 12.5px; color: var(--mint); }

.conv { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; height: 100%; }
.conv-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.conv-head b { font-size: 17px; color: var(--ink); }
.grow { flex: 1; }
.msgs { overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 2px; }
.more { align-self: center; margin-bottom: 10px; }
.day { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: capitalize; }
.day::before, .day::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.msg { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.msg:hover { background: var(--soft); }
.msg.grouped { padding-top: 1px; }
.av { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.av.ghost { height: 0; }
.who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.who b { color: var(--ink); }
.at { font-size: 12px; color: var(--muted); }
.text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.deleted { margin: 2px 0 0; color: var(--muted); font-style: italic; }
.del { opacity: 0; border: 0; background: none; color: var(--muted); font-size: 18px; width: 28px; height: 28px; border-radius: 7px; }
.msg:hover .del, .del:focus-visible { opacity: 1; }
.del:hover { background: var(--red-soft); color: var(--red); }
.file { margin-top: 6px; display: flex; gap: 10px; align-items: center; max-width: 420px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; }
.file:hover { border-color: #c5cfda; }
.file .ic { width: 36px; height: 42px; border-radius: 7px; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; font-weight: 800; font-size: 10.5px; flex: none; }
.file b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file small { color: var(--muted); font-size: 12.5px; }
.typing { min-height: 22px; padding: 0 24px; font-size: 12.5px; color: var(--muted); }
.composer { padding: 0 22px 18px; display: grid; gap: 8px; }
.compose-row { display: flex; gap: 8px; align-items: flex-end; border: 1px solid #dce3ea; border-radius: 14px; padding: 6px; background: #fff; }
.compose-row:focus-within { border-color: var(--teal); box-shadow: var(--ring); }
.compose-row textarea { border: 0; background: none; min-height: 40px; max-height: 180px; resize: none; box-shadow: none; padding: 9px 6px; }
.compose-row textarea:focus { box-shadow: none; background: none; }
.chip-row:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 11px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: 13px; font-weight: 600; }
.chip button { border: 0; background: none; color: inherit; font-size: 16px; }
.warn { border: 1px solid #f1c4bf; background: var(--red-soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.warn b { color: var(--red); }
.warn p { margin: 4px 0 10px; }
.empty { display: grid; place-content: center; text-align: center; gap: 6px; padding: 40px 20px; grid-row: 1 / -1; }
.empty h2 { margin: 0; color: var(--ink); letter-spacing: -.02em; }
.empty .row { justify-content: center; margin-top: 10px; }

/* Fenêtres */
.veil { position: fixed; inset: 0; background: rgba(11, 27, 46, .35); display: grid; place-items: center; padding: 16px; z-index: 50; backdrop-filter: blur(3px); }
.modal { width: min(480px, 100%); max-height: 85vh; overflow-y: auto; background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 30px 70px -20px rgba(11, 27, 46, .5); }
.modal h2 { margin: 0 0 14px; font-size: 19px; color: var(--ink); }
.modal .sub { color: var(--muted); margin: 0 0 12px; }
.picks { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.pick { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; text-align: left; width: 100%; }
.pick:hover { border-color: #c5cfda; background: var(--soft); }
.pick small { color: var(--muted); }
.pick .av { width: 30px; height: 30px; font-size: 11.5px; border-radius: 8px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.toast.bad { background: var(--red); }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { padding-top: max(14px, env(safe-area-inset-top)); }
  body:not(.in-conv) .conv { display: none; }
  body.in-conv .side { display: none; }
  .msgs, .conv-head, .composer { padding-left: 12px; padding-right: 12px; }
  .composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .conv-head { gap: 8px; }
  .msg .del { opacity: 1; }
}
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.pick.off { opacity: .55; cursor: not-allowed; }
.pick.off:hover { background: #fff; border-color: var(--line); }
.muted.small { font-size: 12.5px; margin: 6px 0 0; }

/* Recherche et annuaire */
.search-wrap { position: relative; }
.search { width: 100%; min-height: 38px; padding: 8px 12px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 14px; outline: none; }
.search::placeholder { color: #9fb3c8; }
.search:focus { background: rgba(255, 255, 255, .16); box-shadow: 0 0 0 2px var(--mint); }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: 2px; padding: 6px; background: #fff; border-radius: 12px; box-shadow: 0 24px 48px -20px rgba(11, 27, 46, .5), 0 0 0 1px rgba(11, 27, 46, .08); color: var(--text); max-height: 360px; overflow-y: auto; }
.results .none { margin: 8px; color: var(--muted); font-size: 13.5px; }
.ch.dir { color: #fff; font-weight: 600; }
.person { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: #fff; text-align: left; }
.person:hover { background: var(--soft); }
.person .av { width: 34px; height: 34px; font-size: 12px; }
.person-text { display: grid; flex: 1; min-width: 0; }
.person-text b { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .write { font-size: 13px; font-weight: 700; color: var(--teal); }
.person.off { opacity: .6; }
.dir-body { overflow-y: auto; padding: 18px 22px; display: grid; gap: 14px; align-content: start; grid-row: 2 / -1; }
.directory { display: grid; gap: 4px; max-width: 760px; }
.directory .person { border: 1px solid var(--line); padding: 10px 12px; }
.dir-body > .input { max-width: 760px; }

/* Présence */
.presence { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: #9aa5b3; box-shadow: 0 0 0 2px var(--navy); }
.presence.online { background: #22c55e; }
.presence.away { background: #f59e0b; }
.conv-head .presence, .person .presence { box-shadow: 0 0 0 2px #fff; }
.person .av { position: relative; }
.person .av .presence { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.status .presence { box-shadow: none; }
.back { display: none; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--ink); padding: 0 6px 2px 0; }
@media (max-width: 760px) { .back { display: inline-block; } }
