/* Secure Console workspace placement.
   Desktop: occupies the free lane between the navigation sidebar and Agent Chat.
   Compact screens: becomes a safe centered utility window. */
#consoleDrawer {
  --console-left: auto;
  --console-right: 472px;
  --console-top: 236px;
  --console-width: 540px;
  --console-height: 680px;
  left: var(--console-left) !important;
  right: var(--console-right) !important;
  top: var(--console-top) !important;
  bottom: auto !important;
  width: var(--console-width) !important;
  height: var(--console-height) !important;
  min-width: 390px;
  min-height: 320px;
  border: 1px solid rgba(32, 35, 42, .1) !important;
  border-radius: 22px;
  overflow: hidden;
  transform: translateY(18px) scale(.985) !important;
  transform-origin: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, transform .24s cubic-bezier(.2, .8, .2, 1),
              left .2s ease, right .2s ease, top .2s ease !important;
  box-shadow: 0 24px 68px rgba(31, 38, 53, .18), 0 2px 14px rgba(230, 41, 47, .08) !important;
}

#consoleDrawer.open {
  transform: translateY(0) scale(1) !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#consoleDrawer .cd-head {
  padding: 10px 12px !important;
  gap: 8px !important;
  background: rgba(255, 255, 255, .72);
}

#consoleDrawer .cd-head-group {
  gap: 6px !important;
}

#consoleDrawer .cd-head .btn,
#consoleDrawer .cd-head .topscope {
  min-height: 34px;
}

#consoleDrawer .cd-window-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

#consoleDrawer .cd-window-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(32, 35, 42, .1);
  border-radius: 10px;
  background: rgba(255, 255, 255, .82);
  color: #5e6673;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

#consoleDrawer .cd-window-btn:hover {
  background: #fff;
  color: #17191e;
  transform: translateY(-1px);
}

#consoleDrawer .cd-window-btn.danger:hover {
  background: rgba(230, 41, 47, .1);
  color: #b91520;
}

#consoleDrawer .cd-window-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#consoleDrawer.console-maximized {
  inset: 18px !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  z-index: 10040 !important;
  min-width: 0;
  min-height: 0;
}

#consoleDrawer.console-minimized {
  top: auto !important;
  bottom: 18px !important;
  left: var(--console-left) !important;
  right: var(--console-right) !important;
  width: min(430px, var(--console-width)) !important;
  height: 58px !important;
  min-width: 300px;
  min-height: 58px;
  border-radius: 16px;
}

#consoleDrawer.console-minimized .cd-head {
  height: 58px;
  border-bottom: 0;
  flex-wrap: nowrap;
}

#consoleDrawer.console-minimized .cd-head-group,
#consoleDrawer.console-minimized .cd-divider,
#consoleDrawer.console-minimized .cd-status,
#consoleDrawer.console-minimized .cd-term-shell {
  display: none !important;
}

#consoleDrawer.console-minimized .cd-status-group {
  margin-inline-start: auto;
}

#consoleDrawerBtn {
  position: static !important;
  inset: auto !important;
  transform: none !important;
}

@media (min-width: 1181px) {
  /* Restore the original edge-aligned application shell. The presentation
     layer previously used auto margins without an explicit width, allowing
     the flex item to shrink and center the whole sidebar/workspace. */
  .shell {
    width: calc(100% - 32px) !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 16px !important;
  }
}

@media (max-width: 1180px) {
  #consoleDrawer:not(.console-maximized):not(.console-minimized) {
    left: 18px !important;
    right: 18px !important;
    top: 92px !important;
    bottom: 18px !important;
    min-width: 0;
  }

  #consoleDrawer.console-minimized {
    left: 18px !important;
    width: min(430px, calc(100vw - 36px)) !important;
  }
}

@media (max-width: 720px) {
  #consoleDrawer,
  #consoleDrawer.console-maximized {
    left: 8px !important;
    right: 8px !important;
    top: 8px !important;
    bottom: 8px !important;
    border-radius: 16px;
  }

  #consoleDrawer .cd-head {
    align-content: flex-start;
    overflow: auto;
  }

  #consoleDrawer .cd-divider {
    display: none;
  }

  #consoleDrawer .cd-status-group {
    margin-inline-start: 0;
  }
}
