
body { min-height:100svh;background-image:radial-gradient(ellipse at top left,color-mix(in srgb,var(--cyan) 10%,transparent),transparent 55%); }
main { min-width:0; }
.brand { font-weight:800;letter-spacing:.17em;text-decoration:none; }
.shell-header header,.shell-header header nav { display:flex;align-items:center;gap:12px;flex-wrap:wrap; }
.shell-header header { justify-content:space-between;border-bottom:var(--border); }
.shell-header h1,.shell-drawer h1 { font-size:36px; }
.registry-nav,.registry-taskbar { display:flex;gap:8px;flex-wrap:wrap; }
.app-link { display:flex;align-items:center;gap:8px;text-decoration:none; }
.registry-taskbar { position:relative;margin:0;flex-direction:row;align-items:center;width:auto;border-top:var(--border);padding:8px; }
.registry-launcher { display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:16px; }
.shell-drawer [data-registry-nav] a[aria-current=page],.shell-header-sidebar [data-registry-nav] a[aria-current=page] { background:color-mix(in srgb,var(--cyan) 10%,var(--surface));border-left:3px solid var(--cyan);border-radius:10px;color:var(--text); }
#menu-backdrop { position:fixed;inset:0;border:0;border-radius:0;background:var(--overlay);z-index:20;margin:0;width:100%;height:100%;transform:none; }
.shell-drawer #server-navigation,.shell-drawer .sidebar { position:fixed;inset:0 auto 0 0;width:248px;max-width:calc(100vw - 32px);background:var(--surface);border-right:var(--border);padding:24px 16px;z-index:30;overflow-y:auto; }
@media(max-width:1023px) { .registry-taskbar { display:none; } }
@media(max-width:640px) { .shell-header main { padding:16px; } .shell-header header nav { width:100%; } .shell-header h1 { font-size:32px; } }
.shell-drawer main{min-width:0;max-width:1600px;padding:32px}
.shell-drawer h1{font-size:36px}
.shell-drawer .topbar{min-height:64px;display:flex;align-items:center;gap:16px;padding:8px 32px;border-bottom:var(--border);background:var(--surface);flex-wrap:wrap}
.shell-drawer .topbar button{margin:0}
.shell-drawer .section-name{font-size:20px;font-weight:600}
.shell-drawer #connection-state{color:var(--warning);font-size:12px;margin-left:auto}
.shell-drawer .brand{display:block;font-weight:800;letter-spacing:.17em;text-decoration:none;margin-bottom:24px}
.shell-drawer [data-registry-nav]{display:flex;flex-direction:column;gap:8px}
.shell-drawer [data-registry-nav] a{text-decoration:none;border-left:3px solid transparent;border-radius:10px;transition:background-color 160ms}
.shell-drawer [data-registry-nav] a:hover{background:var(--surface-raised)}
.shell-drawer .nav-group{display:block;font-size:12px;color:var(--muted);margin-top:16px}
body.shell-drawer.menu-open{overflow:hidden}
.shell-drawer #menu-close{margin:0 0 8px}
@media(min-width:1024px){body.shell-drawer:not(.shell-cockpit):not(.embedded-app){padding-left:248px}
.shell-drawer #menu-toggle,.shell-drawer #menu-close{display:none}
.shell-drawer #server-navigation{animation:none}}
@media(max-width:640px){.shell-drawer main{padding:16px}
.shell-drawer .topbar{padding:12px 16px;gap:12px}
.shell-drawer #connection-state{order:4;width:100%;margin:0}
.shell-drawer .topbar #logout{margin-left:auto}
.shell-drawer h1{font-size:32px}}
.shell-drawer .toolbar h2{margin-right:auto}
.shell-header-sidebar .nav-group{display:none}
@media(min-width:1024px){body.shell-header-sidebar:not(.embedded-app){padding-left:248px}
.shell-header-sidebar main{max-width:1600px;padding:32px}
.shell-header-sidebar header{min-height:64px}
.shell-header-sidebar header nav{position:fixed;inset:0 auto 0 0;width:248px;background:var(--surface);border-right:1px solid var(--line);padding:96px 16px 24px;display:flex;flex-direction:column;align-items:stretch;gap:8px}
.shell-header-sidebar .nav-group{display:block;font-size:12px;color:var(--muted);margin-top:16px}
.shell-header-sidebar header .brand{position:fixed;z-index:1;top:24px;left:24px}
.shell-header-sidebar header nav a{text-decoration:none}
.shell-header-sidebar header nav button{margin-top:auto}}
.shell-header-sidebar header nav a{display:flex;align-items:center;min-height:44px}
@media(max-width:1023px){.shell-header-sidebar header nav{display:none;width:100%;padding:16px;border:var(--border);border-radius:16px;background:var(--surface);animation:panel-in var(--motion-panel) ease-out}
.shell-header-sidebar header nav.open{display:flex;flex-direction:column;align-items:stretch}}
.shell-header-sidebar header nav a,.shell-header-sidebar button{gap:8px}
.shell-header-sidebar .header-title h1{font-size:24px;margin:0}
.shell-header-sidebar .user-controls{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0}
.shell-header-sidebar .user-controls button{margin:0}
.shell-header-sidebar header{padding-bottom:16px}
.shell-header-sidebar header nav a{transition:background-color 160ms,color 160ms}
.shell-header-sidebar header nav a:hover{background:var(--surface-raised)}
@media(min-width:1024px){.shell-header-sidebar header{height:64px;padding-bottom:0;flex-wrap:nowrap}}
@media(max-width:1023px){.shell-header-sidebar .user-controls{order:3;width:100%;justify-content:space-between}
.shell-header-sidebar header nav{order:4}
.shell-header-sidebar .header-title h1{font-size:32px}}
body.shell-login{ margin: 0; padding: 2rem 1rem; }
.shell-login main{ max-width: 30rem; margin: auto; }
body.shell-cockpit{min-height:100svh;display:grid;place-items:center;padding:24px;background-color:var(--bg);background-image:linear-gradient(color-mix(in srgb,var(--line) 12%,transparent) 1px,transparent 1px),linear-gradient(90deg,color-mix(in srgb,var(--line) 12%,transparent) 1px,transparent 1px);background-size:48px 48px;isolation:isolate}
.shell-cockpit .aurora{position:fixed;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(ellipse at 25% 20%,color-mix(in srgb,var(--cyan) 11%,transparent),transparent 55%),radial-gradient(ellipse at 80% 80%,color-mix(in srgb,var(--violet) 12%,transparent),transparent 55%);animation:ambient var(--motion-ambient) ease-in-out infinite alternate}
.shell-cockpit .brand{font-weight:750;letter-spacing:.18em;font-size:24px}
.shell-cockpit .brand span{font-size:12px;color:var(--cyan);margin-left:8px;letter-spacing:.08em}
.shell-cockpit .eyebrow{color:var(--muted);margin:8px 0 24px;font-size:12px;letter-spacing:.12em;text-transform:uppercase}
.shell-cockpit h1{font-size:32px;line-height:1.2;margin:0 0 16px}
body.shell-cockpit.paused .aurora{animation-play-state:paused}
@media(max-width:640px){body.shell-cockpit{padding:16px}}
.shell-cockpit #monitoring h2{font-size:24px;margin:0 0 12px}
body.shell-cockpit.authenticated{display:block;padding:0}
.shell-cockpit .sidebar .brand{padding:0 12px}
.shell-cockpit .sidebar-caption{font-size:12px;letter-spacing:.18em;color:var(--muted);padding:0 12px;margin:8px 0 36px}
.shell-cockpit .nav-group{font-size:12px;letter-spacing:.09em;text-transform:uppercase;color:var(--muted);padding:16px 12px 4px}
.shell-cockpit .sidebar-foot{margin-top:auto;padding:32px 12px 0;color:var(--muted);font-size:12px}
.shell-cockpit .sidebar-foot span{font-size:12px}
.shell-cockpit #workspace{margin-left:248px;min-width:0}
.shell-cockpit .breadcrumb,.shell-cockpit .user{font-size:13px;color:var(--muted)}
.shell-cockpit .breadcrumb span{margin:0 12px;color:var(--line)}
.shell-cockpit .breadcrumb strong{color:var(--text);font-weight:500}
.shell-cockpit .user-controls{display:flex;gap:16px;align-items:center}
.shell-cockpit .topbar button{width:auto;display:flex;gap:8px;align-items:center;margin:0;padding:8px 12px;border:1px solid var(--line);font-size:12px}
.shell-cockpit .cockpit-content{max-width:1600px;padding:32px;margin:0 auto;animation:enter 360ms ease-out}
.shell-cockpit .welcome .eyebrow{color:var(--cyan);margin-bottom:12px}
.shell-cockpit .welcome h1{font-size:36px;margin-bottom:12px}
.shell-cockpit #monitoring h2{font-size:20px;margin:0 0 4px}
.shell-cockpit .section-heading h2{font-size:18px;margin:0}
.shell-cockpit .cockpit-content footer{display:flex;justify-content:space-between;gap:16px;margin:32px 0 0;color:var(--muted);font-size:12px;border-top:1px solid var(--line);padding-top:20px}
.shell-cockpit #menu-toggle,.shell-cockpit #menu-close{display:none}
@media(max-width:1023px){.shell-cockpit #workspace{margin-left:0}
.shell-cockpit #menu-toggle,.shell-cockpit #menu-close{display:flex}
.shell-cockpit #menu-close{width:auto;margin:16px 0 0;padding:8px 12px;font-size:13px}
.shell-cockpit .breadcrumb{margin-right:auto}
.shell-cockpit .user-controls .user{display:none}}
@media(max-width:639px){.shell-cockpit .breadcrumb{font-size:12px}
.shell-cockpit .breadcrumb>span,.shell-cockpit .breadcrumb{color:var(--text)}
.shell-cockpit .breadcrumb{font-size:0}
.shell-cockpit .breadcrumb strong{font-size:13px}
.shell-cockpit .topbar button{font-size:12px;padding:8px}
.shell-cockpit .cockpit-content{padding:24px 16px}
.shell-cockpit .welcome h1{font-size:28px}
.shell-cockpit .cockpit-content footer{flex-wrap:wrap}}
.shell-public main{max-width:1300px;margin:auto;padding:26px}
.shell-public header,.shell-public .section-head{display:flex;align-items:center;justify-content:space-between;gap:20px}
.shell-public .brand{font-weight:800;letter-spacing:.17em;color:var(--accent);text-decoration:none}
.shell-public h1{font-size:clamp(30px,5vw,54px);line-height:1.12;letter-spacing:-.04em;margin:14px 0 22px}
.shell-public h2{font-size:19px;margin:0 0 14px}
.shell-public h3{font-size:16px;margin:12px 0}
.shell-public .eyebrow{color:var(--accent);text-transform:uppercase;letter-spacing:.12em;font-size:12px}
.shell-public footer{color:var(--muted);font-size:12px;padding:20px 0}
@media(max-width:760px){.shell-public main{padding:16px}}


.shell-cockpit .sidebar { display:flex;flex-direction:column; }
.shell-drawer [data-registry-nav] a { color:var(--muted);padding:12px; }
.shell-drawer [data-registry-nav] a:hover { color:var(--text); }
.shell-drawer .topbar { justify-content:space-between; }
@media(max-width:1023px) {
 .shell-cockpit .sidebar { transform:translateX(-100%);visibility:hidden;transition:transform var(--motion-panel),visibility var(--motion-panel); }
 .shell-cockpit.menu-open .sidebar { transform:none;visibility:visible; }
}

/* Real app views reuse this shell; embedded views have no competing global menu. */
.embedded-app #server-navigation,.embedded-app .topbar,.embedded-app main>header,
.embedded-app .registry-taskbar,.embedded-app #menu-backdrop { display:none !important; }
body.embedded-app { padding-left:0 !important; }
body.embedded-app main,body.embedded-app #workspace { margin-left:0 !important;min-width:0;max-width:100%; }
body.embedded-app { overflow-x:clip; }
.desktop-canvas,.desktop-taskbar { display:none; }
/* Keep window z-order inside the canvas, below both responsive taskbars. */
.desktop-canvas { isolation:isolate;z-index:0; }
@media(min-width:1024px) {
 body.desktop-enabled #workspace { margin-left:0; }
 body.desktop-enabled #navigation { display:none; }
 body.desktop-enabled.desktop-launcher-open #navigation { display:flex;inset:auto auto var(--desktop-canvas-bottom,80px) 16px;width:280px;max-height:calc(100svh - var(--desktop-canvas-bottom,80px) - 80px);border:var(--border);border-radius:var(--radius);box-shadow:var(--shadow-panel);z-index:100; }
 body.desktop-enabled .sidebar-foot,body.desktop-enabled .sidebar-caption { display:none; }
 /* Follow the measured topbar and reserve 44px for the north resize targets. */
 body.desktop-enabled .desktop-canvas { display:block;position:fixed;inset:calc(var(--desktop-canvas-top,80px) + 44px) 16px var(--desktop-canvas-bottom,80px);pointer-events:none; }
 body.desktop-enabled .desktop-taskbar { display:flex;position:fixed;inset:auto 16px 12px;min-height:52px;gap:12px;align-items:center;padding:8px;background:var(--surface);border:var(--border);border-radius:var(--radius);box-shadow:var(--shadow-panel);z-index:101; }
 .desktop-tasks { display:flex;gap:8px;min-width:0;overflow-x:auto; }
 .desktop-taskbar button { width:auto;margin:0;white-space:nowrap; }
 .desktop-taskbar [aria-pressed=true] { border-color:var(--cyan); }
 .desktop-task-group { flex:none; }
 .desktop-task-instances { position:fixed;left:16px;bottom:var(--desktop-canvas-bottom,80px);width:min(360px,calc(100vw - 32px));max-height:calc(100svh - var(--desktop-canvas-bottom,80px) - 80px);overflow-y:auto;display:flex;flex-direction:column;gap:8px;padding:8px;border:var(--border);border-radius:var(--radius);background:var(--surface-raised,var(--surface));box-shadow:var(--shadow-panel); }
 .desktop-task-instances button { flex:none;width:100%;min-height:44px;text-align:left;white-space:normal;overflow-wrap:anywhere; }
 .desktop-task-instances[hidden],.desktop-task-group[hidden],.desktop-tasks > button[hidden] { display:none; }
 .app-window { position:absolute;pointer-events:auto;left:var(--window-x);top:var(--window-y);width:var(--window-width);height:var(--window-height);display:flex;flex-direction:column;overflow:hidden;border:var(--border);border-radius:var(--radius);background:var(--surface);box-shadow:var(--shadow-panel); }
 .app-window[data-focused=true] { border-color:var(--cyan); }
 .app-window[data-maximized=true] { inset:0;width:100%;height:100%;border-radius:var(--radius); }
 body.desktop-enabled .cockpit-content { padding-bottom:90px; }
}
.window-titlebar { display:flex;flex:none;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:4px 8px 4px 16px;border-bottom:var(--border);background:var(--surface-raised,var(--surface)); }
.window-title { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;font-size:14px; }
.window-title > .icon { margin-right:8px; }
.window-controls { display:flex;gap:4px;flex:none; }
.window-controls button { display:grid;place-items:center;width:44px;min-width:44px;height:44px;padding:0;margin:0; }
.window-controls button[hidden] { display:none; }
.app-window iframe { flex:1;width:100%;min-height:0;border:0;background:var(--surface); }
.app-window[hidden] { display:none; }
@media(max-width:1023px) {
 body.desktop-enabled .desktop-taskbar { display:flex;position:fixed;inset:auto 16px calc(var(--mobile-viewport-bottom,0px) + 12px);height:112px;gap:8px;align-items:center;padding:8px;background:var(--surface);border:var(--border);border-radius:var(--radius);box-shadow:var(--shadow-panel);z-index:19;min-width:0; }
 .desktop-taskbar > button { flex:none;width:auto;margin:0;min-height:44px; }
 .desktop-tasks { display:flex;flex:1;flex-direction:column;gap:8px;min-width:0;max-height:100%;overflow-y:auto;padding:4px; }
 .desktop-tasks button { flex:none;width:100%;min-height:44px;margin:0;white-space:normal;overflow-wrap:anywhere; }
 .desktop-taskbar [aria-pressed=true] { border-color:var(--cyan); }
 body.desktop-enabled .cockpit-content { padding-bottom:136px; }
 body.mobile-app-active .cockpit-content { display:none; }
 body.mobile-app-active .desktop-canvas { display:block;position:fixed;inset:var(--mobile-canvas-top,80px) 16px var(--desktop-canvas-bottom,144px);min-width:0; }
 .app-window { display:flex;flex-direction:column;width:100%;height:100%;min-width:0; }
 .app-window .window-titlebar { display:flex;flex:none;min-width:0;gap:8px;padding-left:8px; }
 body.mobile-app-active #workspace { max-width:100%;overflow-x:clip; }
}

/* Persistence feedback stays in its own taskbar row without taking focus. */
.desktop-taskbar.layout-save-failed,.desktop-taskbar.capacity-reached { flex-wrap:wrap; }
.desktop-capacity-status { flex:0 0 100%;min-width:0;margin:0;overflow-wrap:anywhere; }
.desktop-capacity-status[hidden] { display:none; }
.desktop-layout-status { flex:0 0 100%;min-width:0;color:var(--warning);overflow-wrap:anywhere; }
.desktop-layout-status[hidden] { display:none; }
@media(max-width:1023px) {
 body.desktop-enabled .desktop-taskbar.layout-save-failed,body.desktop-enabled .desktop-taskbar.capacity-reached { height:auto;min-height:112px; }
 .desktop-taskbar.layout-save-failed .desktop-tasks,.desktop-taskbar.capacity-reached .desktop-tasks { max-height:96px; }
}

/* Low landscape screens need one scrollable instance row, leaving room for
   the titlebar. Canvas clearance still follows the measured taskbar height. */
@media(max-width:1023px) and (max-height:480px) and (orientation:landscape) {
 body.desktop-enabled .desktop-taskbar,
 body.desktop-enabled .desktop-taskbar.layout-save-failed,
 body.desktop-enabled .desktop-taskbar.capacity-reached { height:auto;min-height:66px;padding:4px; }
 .desktop-taskbar > button { min-width:44px;min-height:44px; }
 .desktop-taskbar .desktop-tasks { flex-direction:row;align-items:center;max-height:none;overflow-x:auto;overflow-y:hidden;padding:6px; }
 .desktop-taskbar .desktop-tasks button { width:auto;min-width:44px;min-height:44px;white-space:nowrap;overflow-wrap:normal; }
 body.desktop-enabled .cockpit-content { padding-bottom:var(--desktop-canvas-bottom,90px); }
}

/* Window hosts are shell surfaces, without shared content-section spacing. */
.app-window { padding:0;margin:0; }

/* Geometry controls share the titlebar keyboard equivalent on desktop. */
.window-geometry-help { position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap; }
.window-resize,.window-resize-strip { display:none; }
.window-titlebar:focus-visible { outline:2px solid var(--cyan);outline-offset:-3px; }
@media(min-width:1024px) {
 /* Full 44px targets: horizontal outsets follow the available viewport
    margin. North targets stay above the titlebar; south targets have their own
    strip outside the iframe, within the stored outer rect and clear of the taskbar.
    North spans between its separate corner targets. Side targets span below
    the titlebar (44px buttons, 8px padding, border) to the south strip. */
 .app-window:not([data-maximized=true]) { overflow:visible; }
 .app-window:not([data-maximized=true]) .window-titlebar { border-radius:var(--radius) var(--radius) 0 0; }
 .window-resize-strip { display:block;position:relative;flex:0 0 44px;height:44px;background:var(--surface-raised,var(--surface));border-radius:0 0 var(--radius) var(--radius); }
 .window-titlebar { cursor:move;touch-action:none;user-select:none; }
 .app-window[data-maximized=true] .window-titlebar { cursor:default; }
 .window-resize { display:block;position:absolute;z-index:2;width:44px;height:44px;touch-action:none; }
 .window-resize-n,.window-resize-s { cursor:ns-resize; }
 .window-resize-n { top:-44px;left:calc(44px + var(--resize-west,0px));right:calc(44px + var(--resize-east,0px));width:auto; }
 .window-resize-s { bottom:0;left:calc(50% - 22px); }
 .window-resize-e,.window-resize-w { top:56px;bottom:44px;height:auto;cursor:ew-resize; }
 .window-resize-e { right:var(--resize-east,0px); }.window-resize-w { left:var(--resize-west,0px); }
 .window-resize-ne { top:-44px;right:var(--resize-east,0px);cursor:nesw-resize; }
 .window-resize-nw { top:-44px;left:var(--resize-west,0px);cursor:nwse-resize; }
 .window-resize-se { bottom:0;right:0;cursor:nwse-resize; }
 .window-resize-sw { bottom:0;left:0;cursor:nesw-resize; }
 .app-window[data-maximized=true] .window-resize,.app-window[data-maximized=true] .window-resize-strip { display:none; }
 .window-geometry-active iframe { pointer-events:none; }
}
