/* Account controls live in the app shell; all styling is external for the app CSP. */
#install-app-settings.account-trigger{position:fixed;left:14px;bottom:max(14px,env(safe-area-inset-bottom));z-index:95;display:flex;align-items:center;gap:10px;min-width:178px;max-width:235px;min-height:52px;padding:8px 12px;border:1px solid #dce2ed;border-radius:28px;background:#fff;color:#202737;box-shadow:0 3px 18px #1a294319;font:inherit;cursor:pointer}
#install-app-settings[hidden],#account-popover[hidden]{display:none!important}
.account-trigger-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:600;flex:1;text-align:left}
.account-avatar{display:inline-flex;align-items:center;justify-content:center;flex:0 0 36px;width:36px;height:36px;overflow:hidden;border-radius:50%;background:#e4eaff;color:#35469f;font-size:16px;font-weight:650}
.account-avatar img{width:100%;height:100%;object-fit:cover}
.account-trigger svg,.account-action svg,#account-close svg,#account-login-close svg{width:20px;height:20px;flex:0 0 20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#account-popover{position:fixed;left:14px;bottom:82px;z-index:190;width:min(350px,calc(100vw - 28px));max-height:calc(100dvh - 170px);overflow:auto;padding:12px;border:1px solid #dae1ed;border-radius:24px;background:#f1f5fc;color:#202737;box-shadow:0 12px 46px #18254330;font-size:14px}
.account-popover-heading{display:flex;align-items:center;justify-content:space-between;padding:0 2px 0 10px;color:#596476;font-size:13px}
#account-close,#account-login-close{display:flex;align-items:center;justify-content:center;width:44px;height:44px;min-width:44px;min-height:44px;border:0;border-radius:50%;background:transparent;color:#526177;cursor:pointer}
.account-current{display:flex;align-items:center;flex-direction:column;gap:10px;padding:8px 12px 20px}
.account-current>.account-avatar{width:64px;height:64px;flex-basis:64px;font-size:27px;border:4px solid #fff}
.account-current>strong{font-size:22px;font-weight:500}.account-current-label{padding:4px 10px;border-radius:12px;background:#e0e8fb;color:#445a92;font-size:12px}
.account-list{background:white;border-radius:16px;overflow:hidden;margin-bottom:8px}
.account-row{display:flex;align-items:center;gap:12px;width:100%;min-height:68px;padding:12px 14px;text-align:left;background:#fff;color:#202737;border:0;border-bottom:1px solid #eef1f6;cursor:pointer}
.account-row:last-child{border-bottom:0}.account-row:disabled{cursor:default;opacity:1}.account-row[aria-current=true]{background:#e8eefb}
.account-row[data-viewed=true]{background:#e0e8fb;box-shadow:inset 3px 0 #728bdb}.account-row[data-viewed=true] .account-row-summary small{color:#445a92;font-weight:600}
.account-row-summary{display:flex;flex-direction:column;gap:4px}.account-row-summary strong{font-size:14px}.account-row-summary small{font-size:12px;color:#637087}
.account-action{display:flex;align-items:center;gap:12px;width:100%;min-height:48px;padding:10px 14px;text-align:left;border:0;border-radius:12px;background:transparent;color:#28384f;font:inherit;font-size:14px;cursor:pointer}
.account-action:hover:not(:disabled),.account-row:hover:not(:disabled),#account-close:hover,#account-login-close:hover{background:#e3eaf7}
.account-action:disabled{opacity:.55;cursor:wait}
#account-status{margin:6px 12px 0;color:#a03d43;line-height:1.5;font-size:13px}#account-status:empty{display:none}
#account-status a{overflow-wrap:anywhere}
#account-login-dialog{width:min(460px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:24px;border:1px solid #dce2ed;border-radius:24px;color:#202737;background:white}
#account-login-dialog::backdrop{background:#13213c65}
.account-login-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}
#account-login-title{margin:0;font-size:23px;font-weight:550}
#account-login-form>p{line-height:1.65;color:#637087;font-size:14px}
#account-login-form label{display:block;color:#495a73;font-size:13px;line-height:1.5}
#account-login-code,.account-link-output{display:block;box-sizing:border-box;width:100%;min-height:88px;margin:8px 0 12px;padding:12px;border:1px solid #cdd6e5;border-radius:12px;background:#f8faff;color:#202737;font:inherit;font-size:14px;resize:vertical;overflow-wrap:anywhere}
#account-login-links{border-top:1px solid #e1e7f0;margin-top:20px;padding-top:12px}#account-login-links:empty{display:none}
#account-login-submit{min-height:48px;width:100%;border-radius:24px}.account-link-label{margin:6px 0}
#account-login-error{color:#a03d43!important;min-height:20px}
#account-login-form button:focus-visible,#account-popover button:focus-visible,#install-app-settings:focus-visible{outline:3px solid #728bdb;outline-offset:3px}
/* Keep the existing patch’s original identity nodes as compatibility anchors. */
body:has(#install-app-settings.account-trigger) .apc-exit-item{display:none!important}
body:has(#install-app-settings.account-trigger) .panel-footer{display:none!important}
body:has(#install-app-settings.account-trigger) .thread-list{padding-bottom:82px}
.agent-owner-label{display:block;font-size:11px;line-height:1.45;color:#697991;margin-top:3px}
#compose-form.account-readonly{background:#f0f3f7;border-color:#dce2e9;box-shadow:none}
#compose-form.account-readonly textarea{cursor:not-allowed;color:#6c7789}
#observe-actions.account-restriction{display:flex;align-items:center;background:#edf2fc;color:#4b5d7b;border:1px solid #dce4f2;border-radius:12px;padding:12px 14px;line-height:1.55;font-size:13px}
#observe-actions.account-restriction[hidden]{display:none}
@media(max-width:800px){
 #install-app-settings.account-trigger{left:12px;bottom:max(10px,env(safe-area-inset-bottom));min-width:156px;max-width:200px;min-height:48px;padding:6px 10px;transition:bottom .22s ease}
 #account-popover{left:12px;bottom:76px;width:min(350px,calc(100vw - 24px));max-height:calc(100dvh - 150px)}
 /* Fix-55: the mobile tab bar (56px + safe-area, fixed, z 20) and this
    pill (fixed, z 95) shared the same bottom band — the pill covered
    the first two tab buttons and swallowed their taps (real-tap test:
    tapping the 任命 tab opened the account popover). While the tab
    bar is up, lift the pill above it (bar top + 10px) and the popover
    above the pill; when the bar yields (chat open), both settle back. */
 body:has(.apc-tabbar.on) #install-app-settings.account-trigger{bottom:calc(66px + env(safe-area-inset-bottom))}
 body:has(.apc-tabbar.on) #account-popover{bottom:calc(124px + env(safe-area-inset-bottom))}
 body:has(#install-app-settings.account-trigger:not([hidden])) .composer{margin-bottom:calc(76px + env(safe-area-inset-bottom))}
 body:has(#install-app-settings.account-trigger:not([hidden])) #observe-actions{margin-bottom:10px}
 #account-login-dialog{padding:20px} .account-action{min-height:48px}
}
