:root { --bg: #f5f6f8; --fg: #1f2328; --accent: #0f6cbd; --muted: #656d76; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: var(--bg); color: var(--fg); }
header { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: var(--accent); color: #fff; }
header h1 { font-size: 1.2rem; margin: 0; }
.badge { font-size: .75rem; padding: .15rem .5rem; border: 1px solid #fff; border-radius: 1rem; }
main { max-width: 960px; margin: 2rem auto; padding: 0 1rem; }
.card { background: #fff; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.muted { color: var(--muted); }
form { display: grid; gap: .75rem; margin-top: 1rem; }
label { display: grid; gap: .25rem; font-weight: 600; font-size: .9rem; }
input { padding: .5rem; border: 1px solid #d0d7de; border-radius: 6px; font: inherit; font-weight: normal; }
button { padding: .6rem 1rem; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font: inherit; cursor: pointer; justify-self: start; }
button:disabled { opacity: .6; cursor: wait; }
code { background: #eef1f4; padding: .1rem .3rem; border-radius: 4px; }
.error { color: #b42318; }
.warn { color: #9a6700; }
table.perms { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.perms th, table.perms td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid #eaeef2; }
table.perms tr.bad td { color: #b42318; font-weight: 600; }
ul.groups { list-style: none; padding: 0; }
ul.groups li { display: flex; align-items: center; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid #eaeef2; }
ul.groups button { padding: .3rem .7rem; }
a.button { display: inline-block; padding: .6rem 1rem; border-radius: 6px; background: var(--accent); color: #fff; text-decoration: none; }
header .user { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
header .user button, header .user button.secondary { background: transparent; color: #fff; border: 1px solid #fff; padding: .3rem .7rem; }
main.wide { max-width: 1280px; margin: 1rem auto; }
.chat { display: grid; grid-template-columns: 260px 1fr; gap: 1rem; height: calc(100vh - 6rem); }
.sidebar { display: flex; flex-direction: column; gap: .75rem; background: #fff; border-radius: 8px; padding: .75rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); min-height: 0; }
.sidebar > button { justify-self: stretch; width: 100%; }
ul.conversations { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
ul.conversations li { display: flex; align-items: center; gap: .25rem; padding: .45rem .5rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
ul.conversations li:hover { background: #f0f3f6; }
ul.conversations li.active { background: #e3edf8; font-weight: 600; }
ul.conversations .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.conversations .delete { background: transparent; color: var(--muted); padding: 0 .4rem; font-size: 1.1rem; }
.perm-badge { width: 100%; font-size: .85rem; }
.perm-badge.ok { background: #1a7f37; }
.perm-badge.bad { background: #b42318; }
.small { font-size: .8rem; margin: .25rem 0 0; }
.thread { display: flex; flex-direction: column; min-height: 0; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.turns { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; }
.empty { max-width: 640px; margin: 3rem auto; text-align: center; }
.msg { display: flex; margin: .6rem 0; }
.msg.user { justify-content: flex-end; }
.msg .bubble { max-width: 85%; padding: .6rem .9rem; border-radius: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: #fff; }
.msg.assistant .bubble { background: #f6f8fa; border: 1px solid #eaeef2; width: 85%; }
.answer p { margin: .4rem 0; }
.answer h4 { margin: .6rem 0 .3rem; }
pre { background: #1f2328; color: #e6edf3; padding: .6rem .8rem; border-radius: 6px; overflow-x: auto; font-size: .85rem; margin: .4rem 0; }
pre code { background: none; padding: 0; color: inherit; }
.status { font-weight: 600; padding: .3rem .6rem; border-radius: 6px; margin-bottom: .4rem; }
.status-blocked, .status-error, .status-refused { background: #fdecea; color: #b42318; }
.status-incomplete { background: #fff8c5; color: #9a6700; }
.proposal { border: 1px solid #d4a72c; background: #fffbea; border-radius: 8px; padding: .6rem .8rem; margin: .6rem 0; }
.proposal .tag { background: #9a6700; color: #fff; font-size: .75rem; padding: .1rem .45rem; border-radius: 1rem; }
.code-label { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; font-weight: 600; margin-top: .4rem; }
.code-label .copy { padding: .15rem .5rem; font-size: .75rem; }
.perm-request { border: 1px solid #0f6cbd; background: #eef5fc; border-radius: 8px; padding: .6rem .8rem; margin: .6rem 0; }
details.calls { margin-top: .5rem; font-size: .85rem; }
details.calls li.bad { color: #b42318; }
.thinking { font-style: italic; }
.ask { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid #eaeef2; margin: 0; align-items: flex-end; }
.ask textarea { flex: 1; padding: .5rem; border: 1px solid #d0d7de; border-radius: 6px; font: inherit; resize: vertical; }
dialog { border: 0; border-radius: 8px; max-width: 720px; width: 90%; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
@media (max-width: 760px) { .chat { grid-template-columns: 1fr; height: auto; } .turns { max-height: 60vh; } }
button.secondary { background: #eef1f4; color: var(--fg); }
.sidebar > button.secondary { width: 100%; }
dialog form { margin-top: .75rem; }
dialog .row { display: flex; gap: .5rem; }
p.ok { color: #1a7f37; }
.card .row { display: flex; gap: .5rem; }
.login form .row { margin-top: .5rem; }
[hidden] { display: none !important; }

.ask .attach { padding: .55rem .7rem; font-size: 1.1rem; }
.files { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem .75rem 0; border-top: 1px solid #eaeef2; }
.file-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; padding: .25rem .6rem; border-radius: 1rem; background: #eef5fc; border: 1px solid #c9dcf0; max-width: 100%; }
.file-chip.generated { background: #eefaf1; border-color: #b7e2c4; }
.file-chip a { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22rem; }
.files-note { margin: .35rem .75rem 0; font-size: .82rem; }
.files-note.ok { color: #1a7f37; }
.generated-files { border: 1px solid #b7e2c4; background: #eefaf1; border-radius: 8px; padding: .5rem .8rem; margin: .6rem 0; font-size: .9rem; }
.generated-files ul { margin: .3rem 0 0; padding-left: 1rem; list-style: none; }
.thread.dragging { outline: 3px dashed var(--accent); outline-offset: -6px; }

/* Comptes locaux (O365ADMIN-1) */
.row.spread { justify-content: space-between; align-items: center; }
table.accounts { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; }
table.accounts th, table.accounts td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid #e3e7eb; vertical-align: middle; }
table.accounts tr.disabled td { color: #8a949e; }
table.accounts td.actions { display: flex; flex-wrap: wrap; gap: .35rem; }
table.accounts td.actions button { padding: .3rem .6rem; }
table.accounts .badge { border-color: var(--accent); color: var(--accent); }
