/* Portal desktop enhancement. Without JavaScript, the ordinary board remains usable. */
.desktop-wallpaper, .desktop-show { display: none; }
.desktop-enabled { overflow: hidden; }
.desktop-enabled .app-content { min-height: 100dvh; }
.desktop-enabled .app-header { position: relative; z-index: 1080; }
.desktop-enabled .app-sidebar { background: color-mix(in srgb, var(--app-card) 88%, transparent); backdrop-filter: blur(24px); }
.desktop-enabled #app-menu { overflow: hidden; }
.desktop-enabled .app-sidebar .sidebar-content { flex: 1; min-height: 0; gap: 12px; padding-top: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.desktop-dock-footer { flex: 0 0 auto; max-height: 65%; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.desktop-enabled .app-sidebar nav:not(:has(a)) { display: none; }
.desktop-enabled .app-sidebar nav a,
.desktop-enabled .app-sidebar [data-staff-app-folder] > summary { min-height: 3.1rem; padding: .75rem; }
.desktop-enabled .app-sidebar .staff-navigation-primary { min-height: 0; }
.desktop-enabled .app-sidebar .workspace-board-submenu { display: grid; margin: 0; padding: 0; border: 0; gap: 6px; }
.desktop-enabled .app-sidebar .workspace-board-submenu a { min-height: 3.1rem; padding: .75rem; font-size: .84rem; }
.desktop-enabled .app-sidebar .workspace-board-submenu svg { width: 22px; height: 22px; flex-basis: 22px; }
.desktop-enabled .app-sidebar .staff-app-items { margin-left: 0; padding-left: 0; border-left: 0; }
.desktop-enabled .app-sidebar nav a.desktop-running::after { content: ''; position: absolute; left: 0; top: calc(50% - 3px); height: 6px; width: 3px; border-radius: 8px; background: #8a60ff; }
.desktop-enabled .app-sidebar nav a.desktop-current::after { height: 20px; top: calc(50% - 10px); }
.desktop-enabled .app-sidebar-controls { gap: 4px; padding-bottom: 12px; }
.desktop-enabled :is(.desktop-show, .desktop-assistant) { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 4px; border: 0; border-radius: 0; background: transparent; color: var(--app-ink); box-shadow: none; cursor: pointer; }
.desktop-enabled .desktop-assistant { align-self: center; flex-basis: 56px; width: 100%; height: 56px; margin-bottom: 8px; padding: 0; }
.desktop-assistant img { display: block; width: 48px; height: 48px; max-width: 100%; object-fit: contain; pointer-events: none; }
.desktop-enabled.app-menu-open .desktop-assistant { --desktop-logo-size: clamp(80px, 18dvh, 160px); flex-basis: calc(var(--desktop-logo-size) + 16px); height: calc(var(--desktop-logo-size) + 16px); }
.desktop-enabled.app-menu-open .desktop-assistant img { width: var(--desktop-logo-size); height: var(--desktop-logo-size); }
.desktop-show svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.desktop-enabled .desktop-wallpaper {
  display: block;
  position: fixed;
  inset: var(--app-header-height, 80px) 0 0 var(--app-space);
  pointer-events: none;
  background-color: #fff;
  background-image: url('/static/img/logos/brain1_transparent.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: min(42vw, 520px) auto;
}
.dark-style .desktop-enabled .desktop-wallpaper { background-color: #000; }
.desktop-enabled #app-page > #main { padding: 0; max-width: none; }
.desktop-board #main > :is(.page-heading, .footer, .board-toolbar, .eyebrow),
.desktop-board #help-open { display: none; }
.desktop-board #main > :is(.alerts, .alert, [data-workspace-live-status]) { position: fixed; z-index: 1070; left: calc(var(--app-rail) + 20px); right: 20px; top: var(--app-header-height, 80px); margin: 0; background: var(--app-card); }
.desktop-board :is(.workspace-sections, .project-board-sections, [data-board-cards]) { display: contents; }
.desktop-window { position: fixed; z-index: 200; display: flex; flex-direction: column; box-sizing: border-box; min-width: 0; border: 1px solid color-mix(in srgb, var(--app-ink) 18%, transparent); border-radius: 14px; background: var(--app-paper); color: var(--app-ink); box-shadow: 0 18px 55px #14112422, 0 2px 8px #14112412; overflow: hidden; isolation: isolate; }
.desktop-window[hidden] { display: none !important; }
.desktop-window.is-active { z-index: 240 !important; border-color: color-mix(in srgb, #9876d8 65%, var(--app-line)); box-shadow: 0 24px 80px #14112438, 0 3px 14px #14112418; }
.dark-style .desktop-window { background: #000; box-shadow: 0 24px 80px #0009; }
.desktop-titlebar { display: flex; align-items: center; flex: 0 0 32px; box-sizing: border-box; padding: 0 5px 0 10px; gap: 7px; background: color-mix(in srgb, var(--app-card) 88%, #9c89b9); border-bottom: 1px solid var(--app-line); cursor: grab; touch-action: none; user-select: none; }
.desktop-window.is-moving .desktop-titlebar { cursor: grabbing; }
.desktop-window-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; font: 600 11px/1.4 'Public Sans', sans-serif; letter-spacing: -.01em; }
.desktop-app-glyph { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 4px; background: #8059c6; color: white; font-size: 13px; }
.desktop-app-glyph--services { background: #b77734; }
.desktop-app-glyph--resources { background: #438283; }
.desktop-app-glyph--documents { background: #5b79b4; }
.desktop-app-glyph--team { background: #9b618a; }
.desktop-window-controls { display: flex; gap: 3px; }
.desktop-window-controls button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 5px; background: color-mix(in srgb, var(--app-ink) 7%, var(--app-card)); color: var(--app-ink); font: 15px/1 sans-serif; cursor: pointer; }
.desktop-window-controls button:hover { background: color-mix(in srgb, #9876d8 22%, var(--app-card)); }
.desktop-window-controls .desktop-window-close { background: color-mix(in srgb, #c77c6e 18%, var(--app-card)); }
.desktop-window-controls .desktop-window-close:hover { background: #b75044; color: white; }
.desktop-window-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 22px; scrollbar-width: thin; }
.desktop-window-body > .panel { margin: 0; border: 0; border-radius: 0; padding: 0; background: transparent; box-shadow: none; }
.desktop-window-body .workspace-section-heading { margin-top: 0; }
.desktop-window-body .sp-heading h2 { font-size: 24px; letter-spacing: -.035em; }
.desktop-window-body .workspace-section > details { width: 100%; }
.desktop-window-body .desktop-page-app > .page-heading { margin-top: 0; }
.desktop-window-body .footer { margin-top: 32px; }
.desktop-window-body .sp-stack { max-height: none; }
.desktop-window-body .sp-columns { min-width: 640px; }
.desktop-window-body .workspace-section-heading h2 { font-size: 20px; }
.desktop-window-body .form-select { background: var(--app-card); color: var(--app-ink); }
.dark-style .desktop-window-body .form-select,
.dark-style .desktop-window-body .form-select :is(option, optgroup) { background: #0f172a; color: #e2e8f0; }
.desktop-window-resize { position: absolute; right: 0; bottom: 0; width: 24px; height: 24px; padding: 3px; border: 0; border-radius: 7px 0 0; background: var(--app-paper); color: var(--app-muted); cursor: nwse-resize; touch-action: none; font-size: 13px; }
.desktop-window.is-maximized .desktop-window-resize { display: none; }
.desktop-enabled :is(.desktop-titlebar, .desktop-window button, .desktop-show, .desktop-assistant):focus-visible { outline: 2px solid #8c62d1; outline-offset: -3px; }
.desktop-window [id] { scroll-margin-top: 12px !important; }
@media (max-width: 760px) {
  .desktop-enabled .desktop-window { border-radius: 10px; }
  .desktop-window.is-mobile-background { visibility: hidden; }
  .desktop-window .desktop-titlebar { padding-left: 10px; gap: 6px; flex-basis: 42px; cursor: default; }
  .desktop-window-controls button { width: 34px; height: 36px; }
  .desktop-window-controls button[aria-pressed], .desktop-window-resize { display: none; }
  .desktop-window-body { padding: 14px; }
  .desktop-window-body .sp-columns { min-width: 0; }
  .desktop-enabled .desktop-wallpaper { background-size: 65% auto; }
}
@media (forced-colors: active) { .desktop-window, .desktop-titlebar { border: 1px solid CanvasText; } .desktop-app-glyph { color: CanvasText; } }

.desktop-enabled:not(.app-menu-open) .app-sidebar [data-app-pin] { display: none; }

/* One black canvas, including the window chrome, in dark mode. */
.dark-style .desktop-enabled .desktop-window,
.dark-style .desktop-enabled .desktop-titlebar,
.dark-style .desktop-enabled .desktop-window-body { background: #000; }
.dark-style .desktop-enabled .desktop-window-controls button,
.dark-style .desktop-enabled .desktop-window-resize {
  background: #000 !important;
  color: #e2e8f0 !important;
  box-shadow: none;
}
.dark-style .desktop-enabled .desktop-window-controls button:hover { background: #202020 !important; }
.dark-style .desktop-enabled .desktop-window-controls .desktop-window-close:hover { background: #a43832 !important; }

.desktop-window-controls svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }

.desktop-service-actions, .desktop-library-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; margin: 24px 0; }
.desktop-service-actions > a.panel { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 20px; border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-card); color: var(--app-ink); text-decoration: none; }
.desktop-service-actions > a:hover { border-color: #8c62d1; }
.desktop-service-actions strong { font-size: 16px; }
.desktop-service-actions span { font-size: 13px; line-height: 1.65; color: var(--app-muted); }
.desktop-service-actions b { margin-top: auto; font-size: 12px; font-weight: 600; }
.desktop-service-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.desktop-library-card { margin: 0; padding: 18px; }
.desktop-library form p { max-width: 46rem; }
.desktop-library textarea { max-width: 100%; }
.desktop-enabled .desktop-page-app > .page-heading { display: none; }

/* The staff directory is a desktop canvas, never an app window. */
.desktop-directory #main > .footer { display: none; }
.desktop-directory [data-workspace-directory] {
  position: fixed;
  inset: var(--app-header-height, 80px) 0 0 var(--app-space);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 24px clamp(16px, 3vw, 48px) 48px;
  background: var(--app-paper);
}
.desktop-directory [data-workspace-directory] > .page-heading { margin-top: 0; }
[data-workspace-directory] .page-heading h2 { font-size: clamp(28px, 3vw, 42px); }
.dark-style [data-workspace-directory] .form-select,
.dark-style [data-workspace-directory] .form-select :is(option, optgroup) { background: #0f172a; color: #e2e8f0; }
[data-workspace-directory] .form-select:focus { outline-color: var(--matrix-color-b, #8c62d1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--matrix-color-b, #8c62d1) 20%, transparent); }
.desktop-secondary .desktop-window-body { container-type: inline-size; }
@media (max-width:760px) {
  .desktop-enabled .desktop-secondary { left: 0 !important; top: 0 !important; width: 100vw !important; height: 100dvh !important; border-radius: 0; }
  .desktop-secondary.is-active { z-index: 1120 !important; }
  .desktop-secondary .desktop-titlebar { flex-basis: 44px; }
  .desktop-settings .desktop-window-close { width: auto; min-width: 68px; padding-inline: 12px; gap: 6px; }
  .desktop-settings .desktop-window-close svg { display: none; }
  .desktop-settings .desktop-window-close::before { content: '←'; font-size: 16px; }
  .desktop-settings .desktop-window-close::after { content: 'Back'; font-size: 12px; font-weight: 700; }
}
