/* Browser presentation of the client window. Fixed popups keep viewport coordinates;
   the shell deliberately creates no transform/contain containing block. */
:root {
  --eva-window-inset: 36px;
  --eva-window-inset-y: 16px;
  --eva-window-radius: 16px;
  --eva-window-background: #000;
  --eva-window-border: rgba(27,31,38,.16);
  --eva-window-shadow: 0 12px 40px rgba(27,31,38,.14), 0 2px 8px rgba(27,31,38,.06);
  --eva-window-content-top: calc(var(--eva-window-inset-y) + var(--topbar-height, 37px));
  --eva-window-content-height: calc(100dvh - var(--eva-window-inset-y) * 2 - var(--topbar-height, 37px));
}
:root[data-theme="dark"] {
  --eva-window-background: #000;
  --eva-window-border: rgba(255,255,255,.16);
  --eva-window-shadow: 0 12px 40px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.2);
}
@media(max-width:767px),(max-height:599px) {
  :root { --eva-window-inset:8px; --eva-window-inset-y:8px; --eva-window-radius:12px; }
}
html:has(.app-shell[data-platform]),
body:has(.app-shell[data-platform]) {
  overflow:hidden;
  background:var(--eva-window-background) url("../vendor/eva-window-wallpaper.fcd6365ff81d107d0682.webp") center center / cover no-repeat;
}
body .app-shell[data-platform] {
  position:fixed;
  inset:var(--eva-window-inset-y) var(--eva-window-inset);
  width:auto;
  height:auto;
  min-width:0;
  border-radius:var(--eva-window-radius);
  box-shadow:var(--eva-window-shadow),0 0 0 1px var(--eva-window-border);
}
.app-shell[data-platform] .app-titlebar {
  --titlebar-height:36px;
  height:var(--titlebar-height);
  min-height:var(--titlebar-height);
  flex:none;
  gap:8px;
  padding:0 12px;
}
.app-shell[data-platform] .app-titlebar__menu {
  padding:0;
  margin:0;
  flex:1 1 auto;
  min-width:0;
  gap:8px;
}
.eva-window-lights { display:flex;align-items:center;gap:8px;padding-right:8px;flex:none;cursor:default; }
.eva-window-lights > span { display:block;width:12px;height:12px;border-radius:50%;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12); }
.eva-window-lights > span:nth-child(1) { background:#ff5f57; }
.eva-window-lights > span:nth-child(2) { background:#febc2e; }
.eva-window-lights > span:nth-child(3) { background:#28c840; }
.app-shell[data-platform] .app-titlebar__menu > .app-titlebar__button,
.app-shell[data-platform] .eva-tb-brand { flex:none; }
.app-shell[data-platform] .eva-tb-crumb-slot {
  position:static;
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  white-space:nowrap;
  padding-left:8px;
}
.app-shell[data-platform] .eva-tb-crumb-slot::before { display:none; }
.app-shell[data-platform] .eva-tb-crumb-slot > * { min-width:0;overflow:hidden;text-overflow:ellipsis; }
.app-shell[data-platform] .app-titlebar__brand { display:none; }
.app-shell[data-platform] .app-titlebar__toolbar { flex:none;min-width:0; }
/* Body portals remain in the existing stacking system and keep measured screen coordinates. */
body:has(.app-shell[data-platform]) :is(.eva-dialog-portal,.eva-identity-portal,.eva-im-delete-portal,.eva-loop-task-create-portal,.eva-editor-host,.eva-task-popup-host,.eva-assistant-command-layer) {
  inset:var(--eva-window-content-top) var(--eva-window-inset) var(--eva-window-inset-y);
}
body:has(.app-shell[data-platform]) :is(.semi-modal-mask,.semi-modal-wrap):not(.eva-dialog--container > *) {
  position:fixed !important;
  inset:var(--eva-window-content-top) var(--eva-window-inset) var(--eva-window-inset-y) !important;
  height:var(--eva-window-content-height) !important;
}
body:has(.app-shell[data-platform]) .eva-settings-portal { inset:var(--eva-window-inset-y) var(--eva-window-inset); }
body:has(.app-shell[data-platform]) .eva-settings-portal :is(.semi-modal-mask,.semi-modal-wrap) {
  position:absolute !important;inset:0 !important;height:100% !important;
}
body:has(.app-shell[data-platform]) :is(.yarl__root) {
  inset:var(--eva-window-content-top) var(--eva-window-inset) var(--eva-window-inset-y);
  width:auto;height:auto;
  clip-path:inset(0 round 0 0 var(--eva-window-radius) var(--eva-window-radius));
}
body:has(.app-shell[data-platform]) .eva-dialog .semi-modal { max-width:calc(100vw - var(--eva-window-inset) * 2 - 32px);max-height:calc(var(--eva-window-content-height) - 32px); }
@media(max-width:1000px) {
  .app-shell[data-platform] .eva-tb-updated { display:none; }
  .app-shell[data-platform] .app-titlebar .eva-tb-item { padding-inline:6px; }
}

/* Expanded file previews keep their existing navigation exclusion. */
body:has(.app-shell[data-platform]) :is(.eva-file-preview-sidebar.is-fullscreen,.eva-project-file-preview-sidebar:has(.is-fullscreen),.ch-right-panel--file-preview:has(> .is-fullscreen),.eva-task-file-preview-pane:has(> .is-fullscreen)) {
  inset:calc(var(--eva-window-content-top) + var(--eva-shell-workspace-inset,var(--eva-space-1))) calc(var(--eva-window-inset) + var(--eva-shell-workspace-inset,var(--eva-space-1))) calc(var(--eva-window-inset-y) + var(--eva-shell-workspace-inset,var(--eva-space-1))) calc(var(--eva-window-inset) + var(--eva-shell-workspace-inset,var(--eva-space-1)) + var(--eva-sider-w,72px));
}
@media(max-width:767px) {
  .app-shell[data-platform] .layout-sider { top:var(--eva-window-content-top) !important;bottom:var(--eva-window-inset-y) !important;left:var(--eva-window-inset) !important;height:auto !important; }
}

.app-shell[data-platform] > .fixed { inset:var(--eva-window-content-top) var(--eva-window-inset) var(--eva-window-inset-y); }
@media(max-width:767px) {
  .app-shell[data-platform] .eva-edition-badge,
  .app-shell[data-platform] .app-titlebar__toolbar > .eva-tb-item:not(a):not(button) { display:none; }
  .app-shell[data-platform] .eva-tb-brand { flex:0 1 auto;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis; }
}
@media(max-width:599px) {
  .app-shell[data-platform] .eva-tb-brand { display:none; }
  .app-shell[data-platform] .app-titlebar .eva-tb-item { font-size:12px;padding-inline:4px; }
}
/* Public side sheets, including their masks, use the same client content boundary.
   Container-scoped popup sheets (.semi-sidesheet-popup) already sit inside .app-shell and position against their host. */
body:has(.app-shell[data-platform]) .semi-sidesheet:not(.semi-sidesheet-popup) {
  top:var(--eva-window-content-top);right:var(--eva-window-inset);bottom:var(--eva-window-inset-y);left:auto;
  height:var(--eva-window-content-height);max-width:calc(100vw - var(--eva-window-inset) * 2);
}
body:has(.app-shell[data-platform]) .eva-settings-portal { border-radius:var(--eva-window-radius);overflow:hidden; }
body:has(.app-shell[data-platform]) :is(.semi-modal-mask,.semi-modal-wrap):not(.eva-dialog--container > *):not(.eva-settings-portal *) {
  clip-path:inset(0 round 0 0 var(--eva-window-radius) var(--eva-window-radius));
}

body:has(.app-shell[data-platform]) .semi-sidesheet:not(.semi-sidesheet-popup):has(.semi-sidesheet-mask) { left:var(--eva-window-inset);width:auto;clip-path:inset(0 round 0 0 var(--eva-window-radius) var(--eva-window-radius)); }

/* Windows caption area remains reserved as the business toolbar contracts. */
:root:has(.app-shell[data-platform="windows"]) { --eva-window-radius:8px; }
.eva-window-captions { display:none; }
.app-shell[data-platform="windows"] .eva-window-lights { display:none; }
.app-shell[data-platform="windows"] .app-titlebar { --eva-window-caption-width:46px;position:relative;padding-right:calc(3 * var(--eva-window-caption-width) + 8px); }
.app-shell[data-platform="windows"] .eva-window-captions {
 display:flex;position:absolute;right:0;top:0;height:36px;width:calc(3 * var(--eva-window-caption-width));pointer-events:none;
}
.eva-window-captions > span { width:var(--eva-window-caption-width);display:grid;place-items:center;color:var(--semi-color-text-0); }
.eva-window-captions > span::before { content:"";width:10px;height:10px;box-sizing:border-box; }
.eva-window-captions > [data-caption="minimize"]::before { height:1px;background:currentColor; }
.eva-window-captions > [data-caption="maximize"]::before { border:1px solid currentColor; }
.eva-window-captions > [data-caption="close"]::before { background:linear-gradient(45deg,transparent 46%,currentColor 47%,currentColor 53%,transparent 54%),linear-gradient(-45deg,transparent 46%,currentColor 47%,currentColor 53%,transparent 54%); }
@media(max-width:767px) {
 .app-shell[data-platform="windows"] .eva-tb-brand { display:none; }
}
@media(max-width:399px) {
 .app-shell[data-platform="windows"] .app-titlebar { --eva-window-caption-width:34px; }
}
@media(max-width:599px) {
 .app-shell[data-platform="windows"] .app-titlebar .app-titlebar__toolbar > a[aria-label="产品文档"] { font-size:0;width:24px;justify-content:center;padding-inline:0; }
 .app-shell[data-platform="windows"] .app-titlebar .app-titlebar__toolbar > a[aria-label="产品文档"]::before { content:"?";font-size:12px;border:1px solid currentColor;border-radius:50%;width:14px;height:14px;line-height:14px;text-align:center; }
 .app-shell[data-platform="windows"] .eva-tb-crumb-slot { display:none; }
}

.eva-simulation-menu { max-height:calc(var(--eva-window-content-height) - 16px);overflow-y:auto; }

/* One typography and geometry owner for the right titlebar actions. */
.app-shell[data-platform] .app-titlebar__toolbar {
 display:flex;align-items:center;gap:8px;
 font:400 12px/1.4 var(--eva-font-sans);
}
.app-shell[data-platform] .app-titlebar .app-titlebar__toolbar .eva-tb-item {
 display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;
 height:28px;margin:0;padding:0 8px;font:inherit;white-space:nowrap;
}
@media(max-width:599px) {
 .app-shell[data-platform] .app-titlebar .app-titlebar__toolbar { gap:4px; }
 .app-shell[data-platform] .app-titlebar .app-titlebar__toolbar .eva-tb-item { padding-inline:4px; }
 .app-shell[data-platform="windows"] .app-titlebar .app-titlebar__toolbar > a[aria-label="产品文档"] { font-size:0;padding-inline:0;width:24px; }
}
@media(max-width:767px) {
 .app-shell[data-platform] .app-titlebar .app-titlebar__toolbar > .eva-tb-item:not(a):not(button) { display:none; }
}

.app-titlebar__toolbar .eva-theme-action.semi-button { width:28px;height:28px;min-width:28px;flex:none;padding:0;border-radius:var(--eva-radius-key);color:var(--eva-text-secondary); }
@media(max-width:599px) {
 .app-titlebar__toolbar .eva-theme-action.semi-button { width:24px;min-width:24px; }
}
