/* Account layout adapters. Shared palette and controls come from the modern Web client. */
body{display:block;height:auto;min-height:100dvh;overflow:auto;background:var(--bg);color:var(--text);}
.control-shell{width:100%;max-width:1440px;margin:auto;padding:var(--outer);}
.control-header{position:sticky;top:var(--outer);z-index:20;display:flex;align-items:center;justify-content:space-between;min-height:64px;padding:8px 16px;margin:0 0 12px;border-radius:var(--radius-panel);}
.control-actions button{min-width:44px;min-height:44px;border-radius:999px;}
.control-header .brand{font-size:20px;letter-spacing:-.04em;}
#control-content[data-layout=portal]{padding:0;background:transparent;border:0;min-height:calc(100dvh - 144px);}
.portal-shell{display:grid;grid-template-columns:224px minmax(0,1fr);gap:var(--space-3);align-items:start;}
.portal-nav{position:sticky;top:88px;display:flex;flex-direction:column;gap:6px;padding:12px;min-width:0;border-radius:var(--radius-panel);height:auto;max-height:calc(100dvh - 112px);overflow:visible;}
.portal-nav>a{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:12px;min-height:48px;padding:12px 14px;border-radius:16px;font-size:13px;font-weight:500;color:var(--secondary);text-decoration:none;box-shadow:none;transform:none;background:transparent;}
.portal-nav>a[aria-current],.portal-nav>a:hover{background:transparent;box-shadow:none;color:var(--text);}
.portal-nav>a:active{transform:none;}
.portal-nav svg{width:19px;height:19px;flex:none;}
.portal-nav-label{padding:8px 14px;font-size:11px;letter-spacing:0;color:var(--secondary);}.portal-nav-foot{padding:16px 14px 4px;margin:12px 0 0;border-top:1px solid var(--line);}.portal-main{min-width:0;padding:16px 20px 24px;border-radius:var(--radius-panel);background:var(--surface);}.portal-title{position:relative;min-height:64px;margin:0 0 24px;padding:0;align-items:center;}.portal-title h1,.portal-page h1{font-size:clamp(22px,2.4vw,28px);line-height:1.25;font-weight:600;letter-spacing:-.035em;}.portal-page{gap:20px;}.portal-card,.instance-card,.portal-metric{border:0;border-radius:var(--radius-card);background:color-mix(in srgb,var(--surface-secondary) 50%,var(--surface));box-shadow:none;padding:20px;}.portal-metric strong{font-size:30px;font-weight:600;letter-spacing:-.04em;}.portal-main button,.control-sheet button{border-radius:999px;min-height:44px;border:0;background:var(--surface-secondary);font:inherit;font-size:13px;padding:10px 18px;}.portal-main button.primary,.control-sheet button.primary{background:var(--accent);color:white;}.portal-main button.danger{background:var(--danger);color:white;}#theme{width:44px!important;height:44px!important;min-width:44px;padding:0!important;border-radius:50%!important;}.portal-table-wrap{border:0;border-radius:var(--radius-small);background:var(--surface);}.portal-table th{background:color-mix(in srgb,var(--surface-secondary) 60%,var(--surface));padding:12px 16px;}.portal-table td{padding:15px 16px;border-color:color-mix(in srgb,var(--line) 65%,transparent);}.portal-field input,.portal-field select{border:1px solid var(--line);border-radius:var(--radius-small);min-height:44px;background:var(--surface);}.control-sheet{border-radius:var(--radius-panel);border:1px solid var(--line);padding:24px;max-width:560px;width:calc(100% - 32px);max-height:calc(100dvh - 48px);background:var(--surface);color:var(--text);box-shadow:var(--shadow);overflow:auto;}.control-sheet::backdrop{background:rgb(0 0 0 / var(--veil,.22));backdrop-filter:blur(6px);}.portal-badge{border-radius:999px;}
:where(button,a,input,select):focus-visible{outline:2px solid var(--accent);outline-offset:4px;}
.privacy-footer{text-align:center;padding:20px;font-size:12px;}
@media(max-width:900px){.portal-shell{grid-template-columns:184px minmax(0,1fr);}.portal-main{padding:16px;}.portal-metrics{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:680px){
 .control-shell{padding:8px 8px calc(104px + env(safe-area-inset-bottom));}.control-header{top:8px;min-height:56px;border-radius:28px;padding:6px 12px;}
 .portal-shell{display:block;}.portal-main{padding:20px 16px;border-radius:var(--radius-panel);}
 .portal-nav{position:fixed;top:auto;bottom:max(8px,env(safe-area-inset-bottom));left:8px;right:8px;width:auto;max-height:none;height:74px;border-radius:37px;z-index:30;display:flex;flex-direction:row;align-items:center;gap:2px;padding:6px;overflow-x:auto;scrollbar-width:none;}
 .portal-nav::-webkit-scrollbar{display:none;}
 .portal-nav>a{flex:1 0 54px;min-height:60px;padding:8px 6px;gap:6px;flex-direction:column;justify-content:center;border-radius:30px;font-size:9px;white-space:nowrap;}
 .portal-nav svg{width:19px;height:19px;}.portal-nav-label,.portal-nav-foot{display:none;}.portal-title{gap:12px;flex-wrap:wrap;}.portal-grid{grid-template-columns:minmax(0,1fr);}.portal-metrics{gap:10px;}.portal-metric{padding:16px;}.portal-card{padding:16px;}
}
@media(prefers-reduced-transparency:reduce){.control-header,.portal-nav{background:var(--surface)!important;}.glass-clear::before{display:none;}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;}}
@media(max-width:680px){#control-content[data-layout=portal]{min-height:0;}.privacy-footer{padding:16px;margin:0 0 16px;}.privacy-footer a{color:var(--secondary);font-size:11px;text-decoration:none;}}
.account-portrait{display:inline-flex;width:36px;height:36px;flex:0 0 auto;border-radius:50%;overflow:hidden;align-items:center;justify-content:center;background:var(--surface-secondary);font-size:26px;vertical-align:middle}.account-portrait img{width:100%;height:100%;object-fit:cover}.account-portrait.large{width:96px;height:96px;font-size:66px}.avatar-crop-dialog{width:min(420px,calc(100vw - 32px));max-height:90dvh;overflow:auto;padding:24px;border:1px solid var(--line);border-radius:28px;color:var(--text);background:var(--surface)}.avatar-crop-dialog::backdrop{background:rgba(0,0,0,.35)}.avatar-crop-dialog canvas{display:block;width:100%;aspect-ratio:1;border-radius:50%;touch-action:none}.avatar-crop-dialog p{font-size:13px}.avatar-crop-controls{display:grid;gap:12px;margin-block:20px}.avatar-crop-controls label{display:grid;gap:8px}.avatar-crop-controls input{width:100%}.portal-nav-foot [data-account-avatar]{display:inline-flex;margin-bottom:8px}

/* Capability pools use compact rows; key details stay collapsed until requested. */
.capability-summary{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}
.capability-summary p{margin:0;flex:1;min-width:220px}
.capability-secondary{display:block;color:var(--secondary);font-size:12px;margin-top:4px;font-weight:400}
.capability-actions{display:flex;gap:8px;flex-wrap:wrap}
.capability-actions button,.capability-keys button{font-size:12px;white-space:nowrap}
.capability-keys summary{cursor:pointer;white-space:nowrap;min-height:32px}
.capability-scope{display:block;max-width:180px;overflow-wrap:anywhere;font-size:12px}

.capability-summary{padding:8px 0 16px;background:none;border:0;box-shadow:none}
.capability-flat{border-radius:0;background:transparent;box-shadow:none;margin:0}

/* Application windows own their scroll regions; the document never scrolls. */
html,body{height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}
.control-shell{height:100dvh;max-width:none;margin:0;display:flex;flex-direction:column;gap:12px;overflow:hidden;padding:var(--outer)}
.control-header{position:relative;top:auto;margin:0;flex:none}
#control-content,#control-content[data-layout=portal]{flex:1;min-height:0;height:auto;overflow:hidden}
#control-content[data-layout=auth],#control-content[data-layout=workspace]{overflow-y:auto;overscroll-behavior:contain}
.portal-shell{height:100%;min-height:0;align-items:stretch}
.portal-nav{position:relative;top:auto;max-height:none;height:100%;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.portal-main{height:100%;min-height:0;display:flex;flex-direction:column;overflow:hidden;padding:16px 20px}
.portal-stage{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;padding-bottom:12px}.portal-feedback{flex:none}.portal-page{min-width:0}.portal-title{position:sticky;top:0;z-index:2;background:var(--surface);padding:4px 0 16px;margin-bottom:4px}
.privacy-footer{flex:none;padding:0;font-size:10px;margin:0;line-height:16px}.portal-nav>a{flex-shrink:0}.portal-nav-foot{margin-top:auto}
@media(max-width:680px){
 .control-shell{padding:8px;padding-bottom:max(8px,env(safe-area-inset-bottom));gap:8px}
 .portal-shell{display:flex;flex-direction:column;gap:8px}
 .portal-main{order:0;flex:1;min-height:0;height:auto;padding:16px 12px}
 .portal-nav{order:1;position:relative;inset:auto;width:100%;height:74px;max-height:74px;flex:0 0 74px;overflow-x:auto;overflow-y:hidden}
 .privacy-footer{display:none}.portal-title{min-height:48px}
}
.portal-account-link{display:flex;align-items:center;min-height:44px;color:var(--text);text-decoration:none;border-bottom:1px solid var(--line);font-size:14px}.portal-account-link:last-child{border-bottom:0}
@media(max-width:680px){.portal-nav>a:not([href$="/chat"]):not([href$="/tasks"]):not([href$="/tools"]):not([href$="/library"]):not([href$="/profile"]){display:none}.portal-nav>a{flex:1 0 0;min-width:44px}.portal-nav{overflow-x:hidden}}
#unified-client{position:fixed;inset:0;width:100%;height:100dvh;background:var(--bg)}#unified-client[hidden],.control-shell[hidden]{display:none!important}body[data-client-workspace] .privacy-footer{display:none}#unified-client main{height:auto}#unified-client .toolbar{border-radius:var(--radius-panel) var(--radius-panel) 0 0}

@media(max-width:720px){
 #unified-client aside nav a:is([href$="/settings"],[href$="/usage"],[href$="/server"]){display:none}
 #unified-client aside nav{grid-template-columns:repeat(5,minmax(0,1fr))}
}
/* Account pages are the same right-hand pane, not a second application shell. */
#unified-client [hidden]{display:none!important}
#unified-client #account-content{display:flex;flex-direction:column;flex:1;min-height:0;padding:24px 28px;overflow:hidden}
#unified-client #account-content .portal-stage{padding:0 0 12px;scrollbar-gutter:stable}
#unified-client #account-content .portal-title{position:static;min-height:0;padding:0;margin:0 0 20px;background:none}
#unified-client #account-content .portal-title:empty{display:none}
#unified-client #account-content .portal-title p{margin:0}
#unified-client .shell>aside>nav{grid-template-columns:none}
#unified-client .shell>aside>nav>a{display:flex!important}
#unified-client .sidebar-bottom #connection{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:120px}
@media(max-width:1000px){#unified-client #account-content{padding:20px 16px}}
@media(max-width:540px){#unified-client #account-content{padding:16px 12px}.portal-grid{grid-template-columns:minmax(0,1fr)}}
#workspace-identity{display:flex;align-items:center;gap:8px;min-height:44px;min-width:0;color:var(--text);text-decoration:none;flex:1 0 100%}
#workspace-identity .account-portrait{width:32px;height:32px;flex:none}
@media(max-width:1000px){#workspace-identity{justify-content:center}}

/* Consent-gated multiview discovery uses the existing client surfaces. */
.social-page{max-width:1100px;margin-inline:auto}
.social-consent{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:20px 0;border-bottom:1px solid var(--line)}
.social-consent>span{display:grid;gap:8px}.social-consent small,.social-profile-state small,.social-person small{color:var(--secondary);font-size:12px;line-height:1.6}
.social-consent input{width:22px;height:22px;accent-color:var(--accent);flex:0 0 auto}
.social-content{display:grid;gap:20px;padding-block:20px}.social-profile-state{display:flex;gap:12px;align-items:center;flex-wrap:wrap;font-size:13px;color:var(--secondary)}
.social-profile-state:before{content:'';width:7px;height:7px;background:var(--accent);border-radius:50%}.social-profile-state[data-state=failed]:before{background:var(--danger,#bd3540)}
.social-controls,.social-actions{display:flex;gap:12px;justify-content:space-between;align-items:center;flex-wrap:wrap}.social-actions{justify-content:flex-start}
.social-actions button{display:flex;gap:8px;align-items:center}.social-actions svg,.social-friend-mark svg{width:16px;height:16px}
.social-focus{display:flex;gap:4px;padding:4px;border-radius:99px;background:var(--surface-secondary)}.social-focus button{border-radius:99px;background:transparent;min-height:40px;padding:8px 16px;font-size:13px}.social-focus button[aria-pressed=true]{background:var(--surface);color:var(--accent)}
.social-controls select{max-width:180px;min-height:44px}.social-results,.social-placeholder{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,285px),1fr));gap:16px}
.social-person{display:grid;align-content:start;gap:20px;padding:20px;background:var(--surface);border:1px solid var(--line);border-radius:22px;min-width:0}
.social-person-identity{display:flex;gap:12px;align-items:center;min-width:0}.social-person-identity>div{display:grid;gap:4px;min-width:0}.social-person-identity strong,.social-person-identity small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.social-person-identity .account-portrait{width:46px;height:46px;font-size:32px}
.social-relation{margin-left:auto;white-space:nowrap;font-size:11px;color:var(--secondary)}.social-dimensions{display:flex;gap:8px;flex-wrap:wrap;min-height:28px}.social-dimensions span{padding:5px 9px;border-radius:99px;background:var(--surface-secondary);font-size:11px;color:var(--secondary)}
.social-person-actions{display:flex;justify-content:space-between;gap:10px;align-items:center}.social-person-actions button{font-size:13px;min-height:40px}.social-friend-mark{display:flex;gap:6px;align-items:center;color:var(--accent);font-size:12px}
.social-profile-details{border-top:1px solid var(--line);padding-block:16px}.social-profile-details summary{cursor:pointer;min-height:44px;align-content:center;font-size:14px}.social-profile-details dl{margin:8px 0;display:grid;gap:12px}.social-profile-details dt{font-size:13px;font-weight:600}.social-profile-details dd{margin:0 0 12px;color:var(--secondary);font-size:14px;line-height:1.8;overflow-wrap:anywhere}
.social-empty{padding:48px 20px;text-align:center;color:var(--secondary);font-size:14px;line-height:1.8}.social-feedback{font-size:13px;color:var(--danger,#bd3540)}
@media(max-width:540px){.social-focus{width:100%}.social-focus button{flex:1;padding-inline:10px}.social-controls select{max-width:none;width:100%}.social-relation{font-size:10px}}
