#remoteAssist{width:min(940px,calc(100vw - 24px));box-sizing:border-box;max-height:92dvh;overflow:auto;border:1px solid #dbe3ef;border-radius:22px;padding:24px;background:#fafbfd;color:#243147}#remoteAssist::backdrop{background:#14223888}.assist-head{display:flex;justify-content:space-between;align-items:center}.assist-head h2{margin:0}.assist-head button{font-size:24px}.assist-roles{display:grid;grid-template-columns:1fr 1fr;gap:16px}.assist-roles section{background:white;padding:20px;border:1px solid #dfe5ef;border-radius:16px}#remoteAssist p{line-height:1.6}#remoteAssist label{display:block;margin:12px 0;font-size:14px}#remoteAssist input:not([type=checkbox]){width:100%;box-sizing:border-box;padding:12px;border:1px solid #d7dfec;border-radius:10px;margin-top:7px;font-size:16px}#remoteAssist button{min-height:44px;border:1px solid #d4deed;background:white;border-radius:10px;padding:9px 15px;color:#3567b5;cursor:pointer}#remoteAssist button:disabled{opacity:.5}.assist-notice{padding:14px;background:#edf2fa;border-radius:12px;color:#576980}.assist-toolbar{display:flex;gap:10px;flex-wrap:wrap}.assist-pending:not(:empty){padding:16px;background:#fff4d8;border:1px solid #e5c67a;border-radius:12px;margin:16px 0}#assistCode{display:block;overflow-wrap:anywhere;font:18px monospace;margin:14px 0}#remoteAssist pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#f0f3f8;padding:15px;border-radius:12px;font-size:12px;max-height:240px;overflow:auto}.assist-table{overflow:auto;max-height:320px}#remoteAssist table{width:100%;border-collapse:collapse}#remoteAssist td,#remoteAssist th{text-align:left;padding:10px;border-bottom:1px solid #e0e6ef}#nav .assist-nav{min-height:52px;padding:8px;font-size:12px}@media(max-width:620px){.assist-roles{grid-template-columns:1fr}#remoteAssist{padding:18px}}

#remoteAssist .assist-roles{grid-template-columns:1fr}#remoteAssist [hidden]{display:none!important}#remoteAssist[data-mode="customer"] .assist-roles>section:nth-child(2),#remoteAssist[data-mode="technician"] .assist-roles>section:first-child{display:none}#remoteAssist[data-mode="customer"] #assistOverview,#remoteAssist[data-mode="customer"] #assistSearch,#remoteAssist[data-mode="customer"] #assistCount,#remoteAssist[data-mode="customer"] .assist-table,#remoteAssist[data-mode="customer"] #assistLog,#remoteAssist[data-mode="customer"] #assistExport{display:none}.assist-mode{display:flex;gap:10px;margin-bottom:16px}#assistCopy{margin-bottom:12px}

#demo,#assistDemo,#demoButton{display:none!important}

.remote-connect-choice{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;padding:16px;margin-top:14px;border:1px solid #d8e1ee;border-radius:14px;background:#fff;color:#365a8a}.remote-connect-choice small{color:#8391a5}.remote-connection-banner{display:flex;align-items:center;gap:12px;flex-wrap:wrap;border:1px solid #d9c79f;background:#fffdf6;padding:12px 16px;border-radius:12px;margin-bottom:12px;font-size:12px;color:#8d7137}.remote-connection-banner span{flex:1;color:#748092}.remote-connection-banner button{min-height:36px}

.assist-window-note{font-size:12px;line-height:1.7;padding:9px 12px;color:#8d7137;background:#fffdf6;border:1px solid #eadfc8;border-radius:9px}

.msp-protocol-choice{display:flex;align-items:center;gap:12px;margin:12px 0;color:#756344;font-size:13px}.msp-protocol-choice select{flex:1;min-width:0;padding:10px;border:1px solid #e8e2d5;border-radius:10px;background:white;color:#28313e}

/* R51 role chooser follows the actual session. */
#remoteAssist .assist-mode[hidden]{display:none!important}
#remoteAssist .assist-mode button[aria-pressed="true"]{background:#3567b5;color:white;border-color:#3567b5}
#assistRoleStatus{font-weight:600;margin:12px 0}

/* R52: dedicated remote-connection icon in the upper-right header. */
body[data-appearance=balanced-a] .header-actions>#headerRemoteAssist{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:auto;height:44px;min-height:44px;padding:9px 11px;gap:6px;white-space:nowrap;color:var(--accent);border-color:var(--line)}
#headerRemoteAssist svg{display:block;width:23px;height:23px;flex:none}
#headerRemoteAssist:hover{background:var(--soft)}
#headerRemoteAssist:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

@media(max-width:750px){body[data-appearance=balanced-a] .header-actions>#headerRemoteAssist{font-size:10px;padding:6px 8px;gap:5px}#headerRemoteAssist svg{width:18px;height:18px}}

/* R56 compact role forms: no nested scrolling on the initial customer/engineer views. */
#remoteAssist{width:min(560px,calc(100vw - 20px));max-height:calc(100dvh - 20px);padding:16px;border-radius:16px;overflow-y:auto}
#remoteAssist .assist-head h2{font-size:19px}
#remoteAssist .assist-head button{width:36px;min-height:36px;padding:0;font-size:22px}
#remoteAssist .assist-mode{gap:8px;margin:8px 0}
#remoteAssist .assist-mode button{flex:1}
#remoteAssist #assistRoleStatus{font-size:13px;margin:6px 0}
#remoteAssist .assist-notice{padding:8px 10px;margin:8px 0;font-size:12px;line-height:1.5}
#remoteAssist .assist-roles{gap:0}
#remoteAssist .assist-roles section{padding:10px;border-radius:10px;min-width:0}
#remoteAssist .assist-privacy{margin:0 0 6px;color:#737f90;font-size:11px;line-height:1.5}
#remoteAssist .assist-options{display:flex;flex-wrap:wrap;column-gap:12px}
#remoteAssist .assist-options label{display:flex;align-items:center;gap:5px;margin:0;min-height:34px;font-size:12px}
#remoteAssist .assist-options input{margin:0;flex-shrink:0}
#remoteAssist label{font-size:13px;margin:6px 0}
#remoteAssist input:not([type=checkbox]):not([type=hidden]){padding:9px;margin-top:5px}
#remoteAssist button{min-height:38px;padding:7px 11px;font-size:12px}
#remoteAssist[data-connected="true"] #assistCreate{display:none}
#remoteAssist .assist-code-row{display:flex;align-items:center;gap:8px;margin-top:6px;min-width:0}
#remoteAssist #assistCode{flex:1;min-width:0;margin:0;font:12px/1.5 ui-monospace,monospace;overflow-wrap:anywhere}
#remoteAssist #assistCode:empty::before{content:"连接飞控后生成协助码";color:#8893a1;font:11px/1.5 sans-serif}
#remoteAssist #assistCopy{margin:0;flex-shrink:0}
#remoteAssist #assistAccept,#remoteAssist #assistViewOnly{margin-top:8px}
#remoteAssist #assistStatus{font-size:12px;margin:8px 0;line-height:1.5;overflow-wrap:anywhere}
#remoteAssist .assist-window-note{margin:6px 0;padding:6px 8px;font-size:11px;line-height:1.4}
#remoteAssist .assist-toolbar{gap:6px}
#remoteAssist[data-approved="false"] .assist-session-details{display:none}
#remoteAssist[data-mode="customer"] .assist-session-details{display:none}
#remoteAssist[data-mode="technician"][data-approved="true"]{width:min(860px,calc(100vw - 20px))}
@media(max-height:600px){#remoteAssist{padding:10px}#remoteAssist .assist-notice{margin:5px 0;padding:6px 8px}#remoteAssist .assist-mode{margin:5px 0}#remoteAssist .assist-privacy{font-size:10px}#remoteAssist #assistStatus{margin:5px 0}}

#remoteAssist[data-approved="false"] #assistExport{display:none}

/* R57 match the station's regular header buttons and explicit connection controls. */
body[data-appearance=balanced-a] .header-actions>#headerRemoteAssist{height:34px;min-height:34px;padding:7px 11px;border-radius:8px;font-size:11px;background:var(--card);color:var(--muted);border-color:var(--line)}
#headerRemoteAssist svg{width:18px;height:18px}
#remoteAssist{background:var(--card,#fff);color:var(--text,#25364f);border-color:var(--line,#e5ebf3)}
#remoteAssist button{border-radius:8px;background:var(--card,#fff);border-color:var(--line,#e5ebf3);color:var(--text,#25364f)}
#remoteAssist .assist-roles section{background:var(--card,#fff);border-color:var(--line,#e5ebf3)}
#remoteAssist #assistCreate,#remoteAssist #assistJoin{background:var(--accent,#477de2);border-color:var(--accent,#477de2);color:#fff}
#remoteAssist #assistCreate{display:inline-flex}
#remoteAssist[data-mode="technician"] #assistCreate{display:none}
#remoteAssist .assist-toolbar{align-items:center}
#remoteAssist .assist-toolbar>#assistCreate,#remoteAssist .assist-toolbar>#assistStop{flex:1;justify-content:center}
#remoteAssist button:disabled{cursor:default;opacity:.45}
@media(max-width:750px){body[data-appearance=balanced-a] .header-actions>#headerRemoteAssist{height:34px;min-height:34px;padding:6px 9px;font-size:10px}#headerRemoteAssist svg{width:16px;height:16px}}

.assist-engineer-identity{display:grid;grid-template-columns:1fr auto;gap:4px 10px;margin:8px 0;padding:9px 11px;background:var(--soft,#edf3ff);border:1px solid var(--line,#e5ebf3);border-radius:8px}
#assistEngineerLabel{font-size:12px;color:var(--muted,#8592a7)}
#assistEngineerId{font:600 13px/1.5 ui-monospace,Consolas,monospace;color:var(--text,#25364f);user-select:text;overflow-wrap:anywhere}
#assistEngineerHint{grid-column:1/-1;font-size:11px;color:var(--muted,#8592a7);line-height:1.4}
@media(max-width:360px){.assist-engineer-identity{grid-template-columns:1fr}#assistEngineerHint{grid-column:auto}}

/* R65: persistent remote status and a separate, explicit disconnect action. */
body[data-appearance=balanced-a] .header-actions>#headerRemoteAssist{height:38px;min-height:38px;padding:4px 9px;gap:7px}.header-remote-copy{display:flex;flex-direction:column;align-items:flex-start;gap:2px;line-height:1.15}.header-remote-copy>span{font-weight:600}.header-remote-copy small{font-size:9px;font-weight:400;color:var(--muted)}#headerRemoteAssist[data-remote-state=accepted]{border-color:#65ab94!important;background:#edf8f2!important;color:#247258!important}#headerRemoteAssist[data-remote-state=accepted] small{color:#247258}#headerRemoteAssist:is([data-remote-state=connecting],[data-remote-state=created],[data-remote-state=request],[data-remote-state=waiting],[data-remote-state=reconnect],[data-remote-state=stale]) small{color:#aa722e}#headerRemoteAssist[data-remote-state=error] small{color:#bf4949}body[data-appearance=balanced-a] .header-actions>#headerRemoteDisconnect{display:inline-flex;align-items:center;justify-content:center;min-height:38px;border:1px solid #d98b85;border-radius:8px;background:#fff3f1;color:#ad4038;font-size:11px;padding:7px 10px;white-space:nowrap;flex:0 0 auto}body[data-appearance=balanced-a] .header-actions>#headerRemoteDisconnect[hidden]{display:none!important}#remoteAssist #assistStop:not(:disabled){background:#fff0ed;border-color:#d68b81;color:#ac4036;font-weight:600}#remoteAssist #assistClose{font-size:12px;min-height:34px;padding:6px 12px;width:auto;height:auto}body.dark #headerRemoteAssist[data-remote-state=accepted]{background:#193e35!important;color:#b7e7d2!important}body.dark #headerRemoteAssist[data-remote-state=accepted] small{color:#b7e7d2}body.dark .header-actions>#headerRemoteDisconnect{background:#472d2a;color:#ffd2cc;border-color:#a16c65}@media(max-width:750px){body[data-appearance=balanced-a] .header-actions>#headerRemoteAssist{height:36px;min-height:36px;padding:3px 7px;gap:5px}.header-remote-copy small{font-size:9px}body[data-appearance=balanced-a] .header-actions>#headerRemoteDisconnect{min-height:36px;padding:6px 8px;font-size:10px}}

.assist-native-endpoint{display:grid;gap:8px;padding:12px;background:var(--panel,#f3f6fa);border:1px solid var(--line,#ccd6e3);border-radius:10px;margin:12px 0}.assist-native-endpoint[hidden]{display:none}.assist-native-endpoint output{font-size:20px;font-weight:700;overflow-wrap:anywhere;user-select:text}.assist-native-endpoint small{line-height:1.6}.assist-code-row{flex-wrap:wrap}#assistCode{overflow-wrap:anywhere;min-width:0}#assistRotate{font-size:13px}

/* R68: own invitation and native-link diagnostics are always visible in both roles. */
#remoteAssist .assist-own-code{display:block;padding:10px;border:1px solid var(--line,#dfe5ef);border-radius:10px;margin:8px 0}#remoteAssist .assist-own-code>strong{font-size:12px}#remoteAssist .assist-own-code>small{display:block;font-size:11px;line-height:1.5;color:var(--muted,#737f90);margin-top:6px}#remoteAssist #assistCode:empty::before{content:'本机协助码尚未生成，请允许本站保存数据'}#remoteAssist #assistNativeEndpoint{display:grid}#remoteAssist .assist-own-code #assistCode{font-size:14px}
/* R71: R69 access policy, explicit peer identity and live channel state. */
#remoteAssist .assist-connection-summary{display:grid;gap:8px;margin:10px 0;padding:12px;border:1px solid var(--line,#dfe5ef);border-radius:10px;background:var(--soft,#edf3ff)}
#remoteAssist .assist-connection-summary[hidden],#remoteAssist .assist-engineer-identity[hidden],#remoteAssist #assistNativeAddress[hidden],#remoteAssist #assistShowGuide[hidden]{display:none!important}
#assistSessionTitle{font-size:14px;color:var(--text,#25364f)}
#assistConnectionSummary[data-connected=true]>strong{color:#20815f}
.assist-connection-summary>div,.assist-ip-row{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:12px;min-width:0}
.assist-ip-row{grid-column:1/-1;flex-wrap:wrap}.assist-ip-row strong{font:600 13px/1.5 ui-monospace,monospace;overflow-wrap:anywhere;user-select:text}
.assist-connection-summary b{font-weight:600}.assist-connection-summary small{font-size:11px;line-height:1.5;color:var(--muted,#737f90)}
#assistWebState[data-connected=true],#assistTcpState[data-connected=true]{color:#20815f}
#assistWebState[data-connected=false],#assistTcpState[data-connected=false]{color:var(--muted,#737f90)}
.assist-native-fields{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:10px}
.assist-native-fields>div{display:grid;gap:7px;min-width:0;border:1px solid var(--line,#dfe5ef);border-radius:8px;padding:10px}
.assist-native-fields span{font-size:11px;color:var(--muted,#737f90)}
#remoteAssist .assist-native-fields output,#assistNativeGuide .assist-native-fields output{font:600 17px/1.5 ui-monospace,monospace;overflow-wrap:anywhere;user-select:text}
#assistNativeGuide{width:min(860px,calc(100vw - 24px));max-height:90dvh;box-sizing:border-box;overflow:auto;padding:20px;border:1px solid var(--line,#dfe5ef);border-radius:16px;background:var(--card,#fff);color:var(--text,#25364f)}
#assistNativeGuide::backdrop{background:#14223899}
#assistNativeGuide .assist-guide-head{display:flex;justify-content:space-between;align-items:center;gap:12px}
#assistNativeGuide h2{font-size:20px;margin:3px 0 0}#assistNativeGuide small{display:block;font-size:12px;line-height:1.6;color:var(--muted,#737f90)}
#assistNativeGuide p{font-size:13px;line-height:1.65}
#assistNativeGuide button{min-height:40px;padding:8px 12px;border:1px solid var(--line,#ccd6e3);border-radius:8px;background:var(--card,#fff);color:var(--text,#25364f);cursor:pointer}
#assistNativeGuide button:disabled{opacity:.45;cursor:default}
#assistNativeGuide .assist-guide-tip{padding:10px;border-radius:8px;background:var(--soft,#edf3ff)}
#assistNativeGuide .assist-guide-example{margin:12px 0}#assistNativeGuide summary{cursor:pointer;font-weight:600;font-size:13px;padding:8px 0}
#assistNativeGuide img{display:block;width:100%;height:auto;border-radius:8px;border:1px solid var(--line,#dfe5ef);box-sizing:border-box;margin-bottom:8px}
#assistGuideState{padding:10px 12px;border:1px solid var(--line,#dfe5ef);border-radius:8px;font-weight:600}
#assistGuideState[data-connected=true]{color:#20815f;border-color:#65ab94}
.assist-guide-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:16px}
#assistNativeGuide #assistGuideWeb{background:var(--accent,#477de2);border-color:var(--accent,#477de2);color:white}
@media(max-width:480px){#assistNativeGuide{padding:14px}#assistNativeGuide h2{font-size:18px}.assist-native-fields{grid-template-columns:1fr}.assist-guide-actions>button{flex:1}#remoteAssist .assist-engineer-identity{grid-template-columns:1fr}#remoteAssist .assist-engineer-identity>*{grid-column:1/-1}}
