/* M365 Copilot chat enhancer: code cards + user avatar layout */
.m365-copilot-user .m365-copilot-label{display:none!important}
.m365-copilot-user-row{display:flex;justify-content:flex-end;align-items:flex-start;gap:10px;width:100%;margin-left:auto}
.m365-copilot-user-main{display:flex;flex-direction:column;align-items:flex-end;min-width:0;max-width:min(78%,760px)}
.m365-copilot-user-row .m365-copilot-user{display:inline-flex!important;align-items:center!important;width:auto!important;min-width:0!important;min-height:36px!important;margin-left:auto;align-self:flex-start;max-width:100%;padding:7px 12px!important;line-height:22px!important;border-radius:10px!important;box-sizing:border-box}
.m365-copilot-user-row .m365-copilot-user .m365-copilot-content{display:block;white-space:pre-wrap;line-height:22px;margin:0!important;padding:0!important}
.m365-copilot-user-avatar{width:36px;height:36px;border-radius:50%;object-fit:cover;flex:0 0 36px;background:var(--bs-secondary-bg,#eef1f5);border:1px solid rgba(127,127,127,.16)}
.m365-user-actions{height:25px;display:flex;align-items:center;justify-content:flex-end;gap:4px;padding-top:3px;opacity:0;visibility:hidden;transform:translateY(-2px);transition:opacity .14s ease,transform .14s ease}
.m365-copilot-user-row:hover .m365-user-actions,.m365-copilot-user-row:focus-within .m365-user-actions{opacity:1;visibility:visible;transform:translateY(0)}
.m365-user-action{appearance:none;border:0;background:transparent;color:var(--bs-secondary-color,#8b9098);width:28px;height:24px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
.m365-user-action:hover{color:var(--bs-body-color,#222);background:rgba(127,127,127,.12)}
.m365-user-action:disabled{opacity:.45;cursor:not-allowed}
.m365-user-action i{font-size:15px}

.m365-code-card{--m365-code-bg:#242426;--m365-code-head:#333335;--m365-code-text:#f1f1f3;--m365-code-muted:#b9bbc3;--m365-code-border:rgba(255,255,255,.08);margin:12px 0;border:1px solid var(--m365-code-border);border-radius:14px;overflow:hidden;background:var(--m365-code-bg);color:var(--m365-code-text);box-shadow:0 1px 2px rgba(0,0,0,.08)}
.m365-code-card.is-light{--m365-code-bg:#fff;--m365-code-head:#f4f4f5;--m365-code-text:#202124;--m365-code-muted:#666b73;--m365-code-border:#e4e6ea}
.m365-code-head{height:42px;display:flex;align-items:center;gap:8px;padding:0 10px 0 14px;background:var(--m365-code-head);border-bottom:1px solid var(--m365-code-border)}
.m365-code-lang{font-size:13px;color:var(--m365-code-muted);text-transform:lowercase;white-space:nowrap;margin-right:auto}
.m365-code-tools{display:flex;align-items:center;gap:2px}
.m365-code-tool{appearance:none;border:0;background:transparent;color:var(--m365-code-muted);width:30px;height:30px;border-radius:7px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;font-size:15px;line-height:1}
.m365-code-tool:hover{background:rgba(127,127,127,.16);color:var(--m365-code-text)}
.m365-code-tool.is-text{width:auto;padding:0 7px;font-size:12px;gap:4px;white-space:nowrap}
.m365-code-tool i{font-size:16px;line-height:1}
.m365-code-body{position:relative;max-height:560px;overflow:auto;transition:max-height .2s ease,opacity .16s ease}
.m365-code-card.is-collapsed .m365-code-body,.m365-code-body[hidden]{display:none!important;max-height:0!important;opacity:0;overflow:hidden}
.m365-code-card pre{margin:0!important;padding:14px 16px 16px!important;background:transparent!important;color:inherit!important;border:0!important;white-space:pre;overflow:visible;tab-size:4;font:13px/1.65 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}
.m365-code-card code{background:transparent!important;color:inherit!important;padding:0!important;text-shadow:none!important;font:inherit!important}
.m365-code-editor{display:block;width:100%;min-height:0;max-height:560px;resize:vertical;border:0;outline:0;padding:14px 16px;background:var(--m365-code-bg);color:var(--m365-code-text);font:13px/1.65 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;tab-size:4}
.m365-code-preview-layer{position:fixed;inset:0;z-index:1095;background:rgba(0,0,0,.56);display:flex;align-items:center;justify-content:center;padding:24px}
.m365-code-preview-dialog{width:min(1100px,96vw);height:min(760px,90vh);border-radius:14px;overflow:hidden;background:#fff;box-shadow:0 24px 80px rgba(0,0,0,.35);display:flex;flex-direction:column}
.m365-code-preview-head{height:46px;display:flex;align-items:center;padding:0 14px;border-bottom:1px solid #e6e8ec;color:#222;background:#fafafa}
.m365-code-preview-title{font-size:14px;font-weight:600;margin-right:auto}
.m365-code-preview-close{border:0;background:transparent;width:32px;height:32px;border-radius:7px;cursor:pointer;font-size:20px;color:#555}
.m365-code-preview-close:hover{background:#eceef2}
.m365-code-preview-frame{display:block;width:100%;height:100%;border:0;background:#fff}
.m365-copy-ok{color:#46b96b!important}
.m365-scroll-down{position:fixed;left:50%;top:50%;z-index:1080;transform:translate(-50%,8px) scale(.92);width:34px;height:34px;border-radius:50%;border:1px solid rgba(127,127,127,.18);background:var(--bs-body-bg,#fff);color:var(--bs-primary,#2f6fed);display:flex;align-items:center;justify-content:center;box-shadow:0 5px 16px rgba(0,0,0,.16);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .16s ease,transform .16s ease,visibility .16s}
.m365-scroll-down.is-visible{opacity:1;visibility:visible;pointer-events:auto;transform:translate(-50%,0) scale(1)}
.m365-scroll-down:hover{background:var(--bs-tertiary-bg,#f4f5f7)}
.m365-scroll-down i{font-size:18px}
@media(max-width:575.98px){.m365-copilot-user-row{gap:7px}.m365-copilot-user-main{max-width:82%}.m365-copilot-user-avatar{width:32px;height:32px;flex-basis:32px}.m365-copilot-user-row .m365-copilot-user{min-height:32px!important;padding:5px 10px!important;max-width:100%}.m365-code-head{padding-left:10px}.m365-code-preview-layer{padding:8px}}
@media(prefers-reduced-motion:reduce){.m365-code-body{transition:none}}
