html.compact-local-chat .codex-chat-toggle.compact-revealed:not(.is-hidden) {
  display:flex;align-items:center;justify-content:center;left:16px;right:auto;bottom:16px;
  width:56px;height:56px;border-radius:50%;background:#adf4db;color:#173c32;font-size:0;
  box-shadow:0 3px 14px #0002;
}
html.compact-local-chat .codex-chat-toggle::before {
  content:'';width:26px;height:26px;background:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 25H7a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4h18a4 4 0 0 1 4 4v13a4 4 0 0 1-4 4h-8l-6 5' fill='none' stroke='%23173c32' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
html.compact-local-chat .codex-chat.is-user {
  left:16px;right:auto;bottom:82px;width:380px;max-width:calc(100vw - 32px);
  height:min(620px,82dvh);max-height:82dvh;border:0;border-radius:16px;overflow:hidden;
  background:#e8ebe5;color:#24322c;box-shadow:0 5px 24px #0003;font-family:Arial,sans-serif;
}
html.compact-local-chat .codex-chat.is-user .codex-chat-header {height:42px;flex-basis:42px;background:transparent;color:#46554d;padding:0 14px;font-size:13px;font-weight:400;}
html.compact-local-chat .codex-chat.is-user .codex-chat-close {color:#46554d;background:#ffffff70;border-radius:50%;width:30px;height:30px;font-size:22px;}
html.compact-local-chat .codex-chat.is-user .codex-chat-title {position:relative;align-self:center;flex:0 0 auto;min-height:50px;height:auto;border:0;border-radius:24px;background:#fff;padding:8px 18px 8px 58px;margin:2px 0 18px;color:#27392f;box-shadow:0 2px 12px #0001;}
html.compact-local-chat .codex-chat.is-user .codex-chat-title::before {content:'L';display:flex;align-items:center;justify-content:center;position:absolute;left:9px;top:9px;width:32px;height:32px;border-radius:50%;background:#763cdd;color:#fff;font-size:18px;font-weight:700;}
html.compact-local-chat .codex-chat.is-user .codex-chat-title::after {content:'';position:absolute;left:33px;top:8px;width:9px;height:9px;border:2px solid white;border-radius:50%;background:#44a77d;}
html.compact-local-chat .codex-chat.is-user .codex-chat-panel {background:transparent;}
html.compact-local-chat .codex-chat.is-user .codex-chat-messages {padding:0 16px 16px;background:transparent;overscroll-behavior:contain;}
html.compact-local-chat .codex-chat.is-user .codex-chat-msg {max-width:86%;background:#fff;color:#26372e;border-radius:10px;padding:12px;font-size:14px;line-height:1.45;box-shadow:0 1px 3px #00000008;}
html.compact-local-chat .codex-chat.is-user .codex-chat-msg.mine {background:#c9f1e1;}
html.compact-local-chat .codex-chat.is-user .codex-chat-msg small {color:#617168;font-size:11px;}
html.compact-local-chat .codex-chat.is-user .codex-chat-empty {color:#617168;}
html.compact-local-chat .codex-chat.is-user .codex-chat-form {align-items:center;gap:4px;border:0;border-radius:28px;background:white;padding:6px;margin:10px 12px 14px;}
html.compact-local-chat .codex-chat.is-user .codex-chat-input {min-width:0;min-height:38px;height:38px;max-height:100px;border:0;outline:none;background:transparent;padding:9px 4px;font-size:16px;line-height:20px;color:#26372e;}
html.compact-local-chat .codex-chat.is-user .codex-chat-attach {order:-1;border:0!important;border-radius:50%;background:transparent!important;color:#617168!important;width:38px;min-width:38px;height:38px;font-size:26px;font-weight:400;}
html.compact-local-chat .codex-chat.is-user .codex-chat-send {border:0;border-radius:50%;background:#dce8e1;color:#315543;width:38px;min-width:38px;height:38px;padding:0;font-size:0;}
html.compact-local-chat .codex-chat.is-user .codex-chat-send::after {content:'↑';font-size:24px;}
html.compact-local-chat .codex-chat.is-user .codex-chat-attachment {background:#f6f8f5;color:#26372e;border-color:#d5dfd8;}
/* Detailed reference presentation; all actions continue to use the local chat. */
html.compact-local-chat .codex-chat.is-user {background:#f3f2ec;color:#111;}
html.compact-local-chat .codex-chat.is-user .codex-chat-header {height:54px;flex-basis:54px;padding:8px;align-items:flex-start;justify-content:space-between;}
html.compact-local-chat .codex-chat.is-user [data-chat-heading],html.compact-local-chat .codex-chat.is-user .codex-chat-title {display:none;}
html.compact-local-chat .codex-chat.is-user .codex-chat-close,html.compact-local-chat .compact-chat-settings {width:32px;height:32px;min-width:32px;border:0;border-radius:50%;background:#ddd;color:#111;display:flex;align-items:center;justify-content:center;font:700 25px Arial,sans-serif;padding:0;cursor:pointer;}
html.compact-local-chat .compact-chat-settings {font-size:18px;letter-spacing:1px;}
html.compact-local-chat .compact-chat-identity {align-self:center;display:flex;align-items:center;gap:12px;background:#fff;border:1px solid #eee;border-radius:36px;min-height:64px;padding:10px 20px 10px 12px;margin:0 0 18px;box-shadow:0 5px 16px #0002;box-sizing:border-box;}
html.compact-local-chat .compact-chat-identity>span:last-child {display:flex;flex-direction:column;gap:4px;font:16px Arial,sans-serif;color:#666;}
html.compact-local-chat .compact-chat-identity strong {font-weight:700;color:#111;}
html.compact-local-chat .compact-chat-avatar {position:relative;display:flex;align-items:center;justify-content:center;width:42px;height:42px;border-radius:50%;background:#923df6;color:#fff;font:700 20px Arial,sans-serif;}
html.compact-local-chat .compact-chat-avatar i {position:absolute;top:-2px;right:-2px;width:13px;height:13px;border:2px solid #fff;background:#278a55;border-radius:50%;}
html.compact-local-chat .codex-chat.is-user .codex-chat-messages {padding:0 20px 16px;}
html.compact-local-chat .codex-chat.is-user .codex-chat-msg {max-width:100%;background:#fff;color:#111;box-shadow:0 3px 8px #00000005;border-radius:14px;padding:17px 20px;font-size:16px;line-height:1.4;}
html.compact-local-chat .codex-chat.is-user [data-chat-welcome] small {display:none;}
html.compact-local-chat .codex-chat.is-user [data-chat-welcome] {margin-bottom:15px;}
html.compact-local-chat .codex-chat.is-user .codex-chat-form {margin:8px 16px 10px;padding:5px;gap:4px;box-shadow:0 0 0 1px #e7e7e7,0 5px 16px #0001;}
html.compact-local-chat .codex-chat.is-user .codex-chat-form:focus-within {outline:1px solid #90f5df;}
html.compact-local-chat .codex-chat.is-user .codex-chat-attach {display:none!important;}
html.compact-local-chat .compact-chat-add,html.compact-local-chat .compact-chat-emoji,html.compact-local-chat .codex-chat.is-user .codex-chat-send {flex:0 0 36px;width:36px;min-width:36px;height:36px;border:0;border-radius:50%;background:#eee;color:#111;padding:0;display:flex;align-items:center;justify-content:center;cursor:pointer;}
html.compact-local-chat .compact-chat-add {font:400 36px Arial,sans-serif;}
html.compact-local-chat .compact-chat-emoji svg {width:29px;height:29px;}
html.compact-local-chat .codex-chat.is-user .codex-chat-input {font-size:16px;color:#111;}
html.compact-local-chat .codex-chat.is-user .codex-chat-send {color:#888;}
html.compact-local-chat .codex-chat.is-user .codex-chat-send::after {font-size:29px;}
html.compact-local-chat .compact-chat-footer {text-align:center;color:#777;font:11px Arial,sans-serif;letter-spacing:.4px;padding:0 0 max(10px,env(safe-area-inset-bottom));}
html.compact-local-chat .compact-chat-menu {position:absolute;z-index:4;padding:5px;background:white;border-radius:12px;box-shadow:0 4px 16px #0003;color:#111;max-width:calc(100% - 32px);}
html.compact-local-chat .compact-chat-menu[hidden] {display:none!important;}
html.compact-local-chat .compact-chat-options {left:9px;top:56px;}
html.compact-local-chat .compact-chat-uploads,html.compact-local-chat .compact-chat-emojis {left:16px;bottom:91px;}
html.compact-local-chat .compact-chat-menu button {display:flex;align-items:center;gap:12px;width:100%;border:0;border-radius:8px;background:white;color:#111;text-align:left;font:16px Arial,sans-serif;padding:16px 12px;cursor:pointer;}
html.compact-local-chat .compact-chat-menu button:hover,html.compact-local-chat .compact-chat-menu button:focus-visible {background:#444;color:white;}
html.compact-local-chat .compact-chat-menu svg {width:24px;height:24px;flex:0 0 24px;}
html.compact-local-chat .compact-chat-uploads button span {max-width:170px;line-height:1.3;}
html.compact-local-chat .compact-chat-switch {width:48px;height:28px;border-radius:20px;background:#aaa;margin-left:24px;position:relative;}
html.compact-local-chat [aria-checked=true] .compact-chat-switch {background:#278a55;}
html.compact-local-chat .compact-chat-switch::after {content:'';position:absolute;top:4px;left:4px;width:20px;height:20px;border-radius:50%;background:#fff;}
html.compact-local-chat [aria-checked=true] .compact-chat-switch::after {left:24px;}
html.compact-local-chat .compact-chat-emojis {display:grid;grid-template-columns:repeat(4,1fr);}
html.compact-local-chat .compact-chat-emojis button {font-size:24px;padding:10px;}

@media(prefers-reduced-motion:reduce){html.compact-local-chat .codex-chat.is-user{transition:none!important;}}

html.compact-local-chat .compact-chat-footer{display:flex;align-items:center;justify-content:center;gap:8px;font:12px Arial,sans-serif;letter-spacing:0;color:#666;}
html.compact-local-chat .compact-text-mark{width:16px;height:18px;display:block;margin-left:1px;}

/* Inset on mobile too; keyboard remains outside the panel. */
html.compact-local-chat .codex-chat.is-user{left:16px!important;right:auto!important;bottom:var(--compact-bottom,16px)!important;width:360px!important;max-width:calc(100vw - 32px)!important;height:var(--compact-height,82dvh)!important;max-height:var(--compact-height,82dvh)!important;border-radius:24px!important;}
html.compact-local-chat .codex-chat.is-user .codex-chat-close{font-size:0;}
html.compact-local-chat .codex-chat.is-user .codex-chat-close::after{content:'−';font-size:25px;}
.compact-chat-typing{align-self:flex-start;display:flex;align-items:center;gap:5px;background:#fff;border-radius:15px;padding:12px 16px;margin:0 20px 4px;min-height:34px;box-sizing:border-box;}
.compact-chat-typing[hidden]{display:none!important;}
.compact-chat-typing i{width:7px;height:7px;background:#2687ef;border-radius:50%;animation:compact-typing-wave 1s infinite ease-in-out;}
.compact-chat-typing i:nth-child(2){animation-delay:.16s;}.compact-chat-typing i:nth-child(3){animation-delay:.32s;}
.compact-chat-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
@keyframes compact-typing-wave{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-5px);opacity:1}}
@media(prefers-reduced-motion:reduce){.compact-chat-typing i{animation:none;opacity:1;}}
html.compact-local-chat .compact-keyboard .compact-chat-identity{display:none;}

html.compact-local-chat .compact-chat-settings svg{width:25px;height:25px;}
html.compact-local-chat .compact-chat-add svg{width:28px;height:28px;stroke-width:2.5;}
html.compact-local-chat .codex-chat.is-user .codex-chat-send::after{content:'';display:block;width:28px;height:28px;background:currentColor;mask:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 27V5M6 15 16 5l10 10' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");}
html.compact-local-chat .codex-chat.is-user .codex-chat-close::after{content:'';width:17px;height:2px;background:#111;border-radius:3px;transform:translateY(5px);}

html.compact-local-chat [data-chat-welcome-body]{display:none;}

/* Keep the fixed host clear: Safari must not extend a panel fill into its chrome.
   Paint only the inset surface, and keep the settled host free of a 3D transform. */
html.compact-local-chat .codex-chat.is-user {
  display:flex!important;background:transparent!important;box-shadow:none!important;
  isolation:isolate;transform-origin:left bottom;
  transform:scale(.12);opacity:0;visibility:hidden;pointer-events:none;
  transition:transform 220ms cubic-bezier(.4,0,1,1),opacity 160ms ease,visibility 0s linear 220ms;
}
html.compact-local-chat .codex-chat.is-user::before {
  content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;
  background:#f3f2ec;pointer-events:none;
}
html.compact-local-chat .codex-chat.is-user.is-open {
  transform:none;opacity:1;visibility:visible;pointer-events:auto;
  transition:transform 300ms cubic-bezier(.25,1,.5,1),opacity 120ms ease,visibility 0s;
}
html.compact-local-chat .codex-chat.is-user>.codex-chat-header,
html.compact-local-chat .codex-chat.is-user>.codex-chat-body {opacity:0;transition:opacity 100ms ease;}
html.compact-local-chat .codex-chat.is-user.is-open>.codex-chat-header,
html.compact-local-chat .codex-chat.is-user.is-open>.codex-chat-body {opacity:1;transition:opacity 160ms ease 120ms;}
html.compact-local-chat .codex-chat-toggle.compact-revealed:not(.is-hidden) {
  width:60px;height:60px;background:#74fbe0;color:#071b19;box-shadow:none;
  animation:compact-launcher-return 180ms ease-out;
}
html.compact-local-chat .codex-chat-toggle::before {
  width:32px;height:32px;
  background:center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M15 30H12C6 30 5 28 5 22V15C5 8 7 6 14 6H26C33 6 35 8 35 15V22C35 28 33 30 27 30H24L17 36V28H24C29 28 30 27 30 22V15C30 11 29 11 25 11H15C10 11 10 12 10 16V22C10 25 10 25 15 25Z' fill='%23071b19'/%3E%3C/svg%3E");
}
@keyframes compact-launcher-return {from{opacity:0;transform:scale(.65)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){
  html.compact-local-chat .codex-chat.is-user,
  html.compact-local-chat .codex-chat.is-user>.codex-chat-header,
  html.compact-local-chat .codex-chat.is-user>.codex-chat-body{transition:none!important;}
  html.compact-local-chat .codex-chat-toggle{animation:none!important;}
}
