/* QMC shared app shell */
#qmc-start-nav {
  width: 100%;
  min-height: 100vh;
  background: #eef3f8;
  display: none;
  overflow: auto;
  color: #10233d;
}

#qmc-start-nav.open {
  display: block;
}

#qmc-start-nav #qmc-start-nav-shell {
  grid-template-columns: minmax(0, 1fr);
}

#qmc-start-nav #qmc-start-sidebar-slot {
  display: none;
}

#qmc-app-work-host {
  width: 100%;
  min-height: 100vh;
  display: none;
  background: #fff;
}

#qmc-app-work-host.open {
  display: block;
}

#qmc-app-module-host {
  width: 100%;
  min-height: 100vh;
  display: none;
  background: #f4f6f8;
}

#qmc-app-module-host.open {
  display: flex;
  flex-direction: column;
}

#qmc-app-work-frame {
  width: 100%;
  height: 100vh;
  border: 0;
  display: block;
  background: #fff;
}

body.qmc-startpage-open {
  overflow: hidden;
}

body.qmc-startpage-open .desktop-side-rail {
  visibility: hidden !important;
  pointer-events: none !important;
}

.qmc-workspace-overlay {
  position: fixed;
  top: 52px;
  left: calc(var(--qmc-sidebar-expanded-width, 188px) + 48px);
  width: min(70vw, 1180px);
  height: calc(100vh - 80px);
  max-width: calc(100vw - var(--qmc-sidebar-expanded-width, 188px) - 72px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  min-width: 700px;
  min-height: 500px;
  overflow: hidden;
  resize: both;
  border: 1px solid #b7c3d1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(15, 42, 74, .28);
}

.qmc-workspace-overlay-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 42px;
  min-height: 42px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid #d8e0ea;
  background: #f5f8fb;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.qmc-workspace-overlay-chrome.qmc-workspace-overlay-dragging {
  cursor: grabbing;
}

.qmc-workspace-overlay[data-qmc-workspace-slot="1"] .qmc-workspace-overlay-chrome {
  border-bottom-color: #c8dfce;
  background: #e8f4eb;
}

.qmc-workspace-overlay[data-qmc-workspace-slot="2"] .qmc-workspace-overlay-chrome {
  border-bottom-color: #e4d9a8;
  background: #f7f1d8;
}

.qmc-workspace-overlay[data-qmc-workspace-slot="3"] .qmc-workspace-overlay-chrome {
  border-bottom-color: #e3c5c5;
  background: #f6e5e5;
}

.qmc-workspace-overlay-title {
  min-width: 0;
  overflow: hidden;
  color: #17304e;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qmc-workspace-overlay-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qmc-workspace-overlay-action {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #52677f;
  font-size: 18px;
  line-height: 32px;
  cursor: pointer;
}

.qmc-workspace-overlay-action:hover {
  background: #e7edf4;
  color: #17304e;
}

.qmc-workspace-overlay-close:hover {
  background: #f7e6e6;
  color: #8f2727;
}

.qmc-remote-display-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 34, 50, .34);
}

.qmc-remote-display-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid #d5dee8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 42, 74, .24);
}

.qmc-remote-display-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #17304e;
  font-size: 14px;
}

.qmc-remote-display-dialog-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #607184;
  font-size: 20px;
  cursor: pointer;
}

.qmc-remote-display-dialog-close:hover {
  background: #edf2f7;
  color: #17304e;
}

.qmc-remote-display-dialog-intro {
  margin: 12px 0 0;
  color: #607184;
  font-size: 12px;
  line-height: 1.45;
}

.qmc-remote-display-dialog-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5f8fb;
  color: #4d6278;
  font-size: 12px;
  line-height: 1.4;
}

.qmc-remote-display-qr-wrap {
  margin-top: 14px;
  text-align: center;
}

.qmc-remote-display-qr {
  display: block;
  width: min(220px, 60vw);
  height: auto;
  margin: 0 auto;
  border: 1px solid #dbe3eb;
  border-radius: 10px;
  background: #fff;
}

.qmc-remote-display-viewer-link {
  display: block;
  margin-top: 10px;
  color: #365d84;
  font-size: 11px;
  text-align: center;
  text-decoration: none;
}

.qmc-remote-display-viewer-link:hover {
  text-decoration: underline;
}

.qmc-remote-display-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.qmc-remote-display-dialog-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #c9d4df;
  border-radius: 8px;
  background: #fff;
  color: #2b4058;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.qmc-remote-display-dialog-button:disabled {
  cursor: default;
  opacity: .5;
}

.qmc-remote-display-dialog-primary {
  border-color: #91a9c2;
  background: #eaf1f7;
  color: #17304e;
}

.qmc-workspace-overlay-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 0 0 auto;
  border: 0;
  display: block;
  background: #fff;
  transform-origin: top left;
}

.qmc-workspace-overlay[data-qmc-workspace-slot="2"] {
  top: 76px;
  left: calc(var(--qmc-sidebar-expanded-width, 188px) + 72px);
  height: calc(100vh - 104px);
  max-height: calc(100vh - 104px);
}

.qmc-workspace-overlay[data-qmc-workspace-slot="3"] {
  top: 100px;
  left: calc(var(--qmc-sidebar-expanded-width, 188px) + 96px);
  height: calc(100vh - 128px);
  max-height: calc(100vh - 128px);
}

body.qmc-sidebar-page-compact .qmc-workspace-overlay {
  left: calc(var(--qmc-sidebar-compact-width, 58px) + 48px);
  max-width: calc(100vw - var(--qmc-sidebar-compact-width, 58px) - 72px);
}

body.qmc-sidebar-page-compact .qmc-workspace-overlay[data-qmc-workspace-slot="2"] {
  left: calc(var(--qmc-sidebar-compact-width, 58px) + 72px);
}

body.qmc-sidebar-page-compact .qmc-workspace-overlay[data-qmc-workspace-slot="3"] {
  left: calc(var(--qmc-sidebar-compact-width, 58px) + 96px);
}

.qmc-workspace-overlay.qmc-workspace-overlay-maximized,
body.qmc-sidebar-page-compact .qmc-workspace-overlay.qmc-workspace-overlay-maximized {
  top: 8px;
  right: 8px;
  bottom: 8px;
  left: 8px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  resize: none;
}

@media (max-width: 900px) {
  .qmc-workspace-overlay,
  body.qmc-sidebar-page-compact .qmc-workspace-overlay {
    top: 12px;
    left: 12px;
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    min-width: 0;
    min-height: 320px;
    resize: none;
  }
}
