.app[data-chat-screen]{--chat-green:#07c160;min-height:0}
.chat-page{color-scheme:light}
.app .chat-call-top{z-index:31}
.chat-mute-control .round{border-radius:50%;padding:18px}
.chat-page{position:absolute;inset:0;display:flex;flex-direction:column;background:#101815;color:#191919;z-index:5;overflow:hidden;isolation:isolate}
.chat-header{display:flex;align-items:center;gap:12px;padding:calc(env(safe-area-inset-top) + 5px) 12px 6px;border-bottom:1px solid #ffffff24;background:rgba(0,0,0,0.72);color:#F5F5F2;flex-shrink:0}
.chat-header h1{font-size:17px;font-weight:600;margin:0;flex:1;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-icon{display:flex;align-items:center;justify-content:center;background:transparent;border:0;color:inherit;width:40px;height:40px;flex-shrink:0;font-size:30px;border-radius:8px;cursor:pointer;padding:8px}.chat-icon svg{width:26px;height:26px}
.chat-icon:focus-visible{outline:2px solid #07c160;outline-offset:2px}
.chat-messages{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px 12px;scrollbar-width:thin;overflow-anchor:none;scroll-padding-bottom:12px}
.chat-empty{display:table;text-align:center;color:#fff;font-size:13px;margin:24px auto;padding:6px 10px;border-radius:8px;background:#15241d55;text-shadow:0 1px 3px #0008}.chat-row{display:flex;gap:8px;align-items:flex-start;margin-bottom:10px}.chat-row.user{flex-direction:row-reverse}.chat-row.system{justify-content:center}.chat-avatar{height:32px;width:32px;border-radius:6px;object-fit:cover;background:#ddd;flex-shrink:0}.chat-bubble{position:relative;flex:0 1 auto;width:fit-content;min-height:0;max-width:65%;min-width:0;background:#ffffffb8;border:1px solid #ffffff38;border-radius:8px;padding:6px 10px;font-size:14px;line-height:1.4;backdrop-filter:blur(6px);overflow-wrap:anywhere}.chat-row.user .chat-bubble{background:#b2ed91bf;border-color:#dbffc34d;color:#101810}.chat-bubble p{margin:0;white-space:pre-wrap}.chat-time-group{display:block;margin:12px 0;font-size:11px;line-height:1.4;color:#c5c5c5;text-align:center;text-shadow:0 1px 3px #000b}.chat-task-state{font-size:14px;line-height:1.4;color:#66736b}.chat-bubble small{font-size:14px;line-height:1.4;color:#97553d}.chat-image{display:block;max-width:100%;max-height:300px;border-radius:4px;object-fit:contain}.chat-image-open{display:block;border:0;padding:0;background:none;cursor:zoom-in}.chat-edit-image{padding:8px 0 0;color:#27664a;font-size:12px;border:0;background:none;cursor:pointer}.chat-call-record{display:inline-flex;align-items:center;gap:8px;width:fit-content;min-width:0;min-height:0;max-width:65%;overflow-wrap:anywhere;color:#F5F5F2;font-size:14px;line-height:1.4;text-align:left;background:#15241d66;border-radius:7px;padding:6px 10px;text-shadow:0 1px 3px #0006}.chat-call-record-text{min-width:0}.chat-call-record-icon{display:flex;flex:0 0 20px;width:20px;height:20px}.chat-call-record-icon svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.chat-footer{flex-shrink:0;background:rgba(0,0,0,0.72);color:#F5F5F2;border-top:1px solid #ffffff24;padding-bottom:env(safe-area-inset-bottom)}.chat-composer{display:flex;align-items:center;padding:6px 10px;gap:8px}.chat-input{flex:1;min-width:0;min-height:40px;max-height:112px;padding:8px 10px;resize:none;border:1px solid #ffffff38;border-radius:8px;background:rgba(0,0,0,.48);color:#F5F5F2;font:16px/22px system-ui;margin:0}.chat-send{flex:0 0 48px;width:48px;height:40px;min-width:48px;padding:0 10px;background:#C2FF38;border:0;border-radius:8px;font-size:14px;font-weight:500;color:#101010;box-shadow:none;cursor:pointer}.chat-send:disabled{background:#353a2d;color:#919785;cursor:not-allowed}.chat-reference{display:flex;gap:8px;align-items:center;padding:6px 12px;color:#d2d6cb;font-size:12px}.chat-reference img{width:32px;height:32px;object-fit:contain}.chat-reference span{flex:1}
.chat-resume{border:0;padding:10px;background:#def5e8;color:#247345;font-size:13px}.chat-call-chip{position:absolute;top:calc(env(safe-area-inset-top) + 64px);right:12px;z-index:12;background:#286249;color:white;border:1px solid #6f9d88;box-shadow:0 4px 14px #0003;padding:16px;border-radius:12px}.chat-call-top{position:absolute;top:calc(env(safe-area-inset-top) + 8px);left:12px;right:12px;display:flex;justify-content:space-between;z-index:22;color:white}.chat-call-identity{position:absolute;top:20%;left:16px;right:16px;text-align:center;z-index:3;color:white;pointer-events:none}.chat-call-identity img{width:96px;height:96px;object-fit:cover;border-radius:14px;box-shadow:0 4px 30px #0003}.chat-call-identity h1{font-size:24px;font-weight:500;margin:20px 0 10px}.chat-call-identity p{color:#ffffffb3;font-size:14px}.chat-call-duration{font-variant-numeric:tabular-nums;letter-spacing:2px}
.app[data-chat-screen=chat]>.stage,.app[data-chat-screen=chat]>.floating-identity,.app[data-chat-screen=chat]>.bottom,.app[data-chat-screen=chat]>.chat-call-top,.app[data-chat-screen=chat]>.chat-call-identity,.app[data-chat-screen=chat]>.call-waiting{visibility:hidden;pointer-events:none}
.app[data-chat-screen=call]>.chat-page{display:none}.app[data-chat-screen=call]>.floating-identity{display:none}.app[data-chat-screen=call][data-call-mode=voice] .portrait{filter:blur(35px) brightness(.3);transform:scale(1.12)}.app[data-chat-screen=call][data-call-mode=video]>.chat-call-identity{top:70px;left:16px;right:auto;text-align:left}.app[data-chat-screen=call][data-call-mode=video] .chat-call-identity img{display:none}.app[data-chat-screen=call][data-call-mode=video] .chat-call-identity h1{font-size:16px;margin:0}.app[data-chat-screen=call][data-call-mode=video] .chat-call-identity p{margin:5px 0}.app[data-chat-screen=call] #people-control,.app[data-chat-screen=call] #call-control{display:none}.app[data-chat-screen=call] .bottom{z-index:4}.app[data-chat-screen=call] .controls{display:flex;justify-content:center;gap:28px}.chat-lightbox{background:#141414;color:white;border:0;max-width:96vw;width:640px;padding:14px;border-radius:12px}.chat-lightbox::backdrop{background:#000c}.chat-lightbox>img{display:block;max-width:100%;max-height:65vh;margin:12px auto;object-fit:contain}.chat-lightbox .button{display:block;text-align:center;text-decoration:none;margin-top:8px}
[hidden]{display:none!important}
@media(min-width:700px){.app[data-chat-screen]{max-width:960px;margin:auto;border-inline:1px solid #ddd}.chat-header{padding-inline:24px}.chat-messages{padding:20px 32px}.chat-footer{padding-inline:28px}.chat-bubble{max-width:65%}.chat-image{max-width:340px}.chat-page{border-radius:0}body{background:#101815}}
@media(max-width:370px){.chat-page .chat-icon{width:44px}}

/* The saved portrait stays behind the independently scrolling message list. */
.chat-background{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 0%;z-index:-1;pointer-events:none;user-select:none}

/* V3 chat chrome: alpha belongs to the background, never the controls. */
.chat-page .chat-icon{width:44px;height:44px;padding:10px}
.chat-page .chat-icon svg{width:24px;height:24px}
.chat-composer .chat-phone{color:#C2FF38}.chat-composer .chat-camera{color:#F5F5F2}
.chat-input::placeholder{color:#a5aaa2;opacity:1}
.chat-page .chat-icon:focus-visible,.chat-send:focus-visible{outline:2px solid #C2FF38;outline-offset:2px}

/* Focus stays inside the input border; the 8px control gaps remain clear. */
.chat-input:focus{border-color:#C2FF38;outline:0;box-shadow:none}

/* The phone only opens this chooser; calling still requires an explicit option. */
.chat-call-menu{position:fixed;inset:auto 0 0;margin:0 auto;width:min(100%,500px);max-width:100%;max-height:calc(var(--vh) - 20px);padding:0 0 env(safe-area-inset-bottom);border:1px solid #ffffff24;border-bottom:0;border-radius:16px 16px 0 0;background:rgba(12,12,12,.96);color:#F5F5F2;box-shadow:none}
.chat-call-menu::backdrop{background:#0006;backdrop-filter:none}
.chat-call-option{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:54px;padding:14px 20px;background:transparent;border:0;border-bottom:1px solid #ffffff18;color:#F5F5F2;font-size:16px;text-align:center}
.chat-call-option-icon{display:flex;flex:0 0 20px;width:20px;height:20px;color:#F5F5F2;pointer-events:none}
.chat-call-option-icon svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.chat-call-option:first-child{border-radius:16px 16px 0 0}
.chat-call-cancel{border-top:6px solid #ffffff08;border-bottom:0;color:#bcc2b8}
.chat-call-option:focus-visible{outline:1px solid #C2FF38;outline-offset:-4px}

.chat-image-receipt{font-size:11px;line-height:1.4;margin-top:6px;overflow-wrap:anywhere}.chat-image-receipt summary{cursor:pointer;color:#c6c6c6}.chat-image-receipt small{display:block;margin-top:4px}

.chat-resume.is-ending{background:rgba(0,0,0,.6);color:#c5c5c5;font-size:12px;padding:6px 12px;opacity:1;cursor:default}
#chat-call-mute{padding:0}

/* A small glyph with a 44px hit area; no separate card or fixed bubble width. */
.chat-read-actions{display:flex;justify-content:flex-end;height:20px;margin-top:2px}
.chat-read{display:flex;align-items:center;justify-content:center;position:relative;width:28px;height:20px;padding:0;border:0;border-radius:4px;background:transparent;color:#364c40;cursor:pointer}
.chat-read::before{content:'';position:absolute;inset:-12px -8px}
.chat-read svg{width:16px;height:16px;fill:currentColor;stroke:none;pointer-events:none}
.chat-read[aria-pressed=true]{color:#087541}.chat-read:disabled{color:#777;cursor:not-allowed}
.chat-read:focus-visible{outline:1px solid #087541;outline-offset:2px}

/* Call identity starts after the 44px navigation row and a 12px gap. */
.app[data-chat-screen=call][data-call-mode=video]>.chat-call-identity{top:calc(env(safe-area-inset-top) + 64px);left:calc(env(safe-area-inset-left) + 20px);right:calc(env(safe-area-inset-right) + 20px);max-width:calc(100% - 40px)}
.app[data-chat-screen=call][data-call-mode=video] .chat-call-identity h1{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:22px}
